Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
91691fbd
Commit
91691fbd
authored
Feb 22, 2019
by
Jan S
Committed by
skylot
Feb 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: allow APK files without code (no contained dex files) (PR #455)
parent
9856b6d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
AndroidResourcesUtils.java
...n/java/jadx/core/utils/android/AndroidResourcesUtils.java
+8
-4
InputFile.java
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
+1
-2
No files found.
jadx-core/src/main/java/jadx/core/utils/android/AndroidResourcesUtils.java
View file @
91691fbd
...
@@ -54,6 +54,10 @@ public class AndroidResourcesUtils {
...
@@ -54,6 +54,10 @@ public class AndroidResourcesUtils {
}
}
LOG
.
info
(
"App 'R' class not found, put all resources ids to : '{}'"
,
fullName
);
LOG
.
info
(
"App 'R' class not found, put all resources ids to : '{}'"
,
fullName
);
resCls
=
makeClass
(
root
,
fullName
,
resStorage
);
resCls
=
makeClass
(
root
,
fullName
,
resStorage
);
if
(
resCls
==
null
)
{
// We are in an APK without code therefore we don't have to update an 'R' class with the resources
return
null
;
}
addResourceFields
(
resCls
,
resStorage
,
false
);
addResourceFields
(
resCls
,
resStorage
,
false
);
return
resCls
;
return
resCls
;
}
}
...
@@ -81,18 +85,18 @@ public class AndroidResourcesUtils {
...
@@ -81,18 +85,18 @@ public class AndroidResourcesUtils {
return
rCls
;
return
rCls
;
}
}
private
static
void
addResourceFields
(
ClassNode
c
ls
,
ResourceStorage
resStorage
,
boolean
rClsExists
)
{
private
static
void
addResourceFields
(
ClassNode
resC
ls
,
ResourceStorage
resStorage
,
boolean
rClsExists
)
{
Map
<
String
,
ClassNode
>
innerClsMap
=
new
TreeMap
<>();
Map
<
String
,
ClassNode
>
innerClsMap
=
new
TreeMap
<>();
if
(
rClsExists
)
{
if
(
rClsExists
)
{
for
(
ClassNode
innerClass
:
c
ls
.
getInnerClasses
())
{
for
(
ClassNode
innerClass
:
resC
ls
.
getInnerClasses
())
{
innerClsMap
.
put
(
innerClass
.
getShortName
(),
innerClass
);
innerClsMap
.
put
(
innerClass
.
getShortName
(),
innerClass
);
}
}
}
}
for
(
ResourceEntry
resource
:
resStorage
.
getResources
())
{
for
(
ResourceEntry
resource
:
resStorage
.
getResources
())
{
ClassNode
typeCls
=
innerClsMap
.
computeIfAbsent
(
resource
.
getTypeName
(),
name
->
{
ClassNode
typeCls
=
innerClsMap
.
computeIfAbsent
(
resource
.
getTypeName
(),
name
->
{
ClassNode
newTypeCls
=
new
ClassNode
(
cls
.
dex
(),
c
ls
.
getFullName
()
+
"$"
+
name
,
ClassNode
newTypeCls
=
new
ClassNode
(
resCls
.
dex
(),
resC
ls
.
getFullName
()
+
"$"
+
name
,
AccessFlags
.
ACC_PUBLIC
|
AccessFlags
.
ACC_STATIC
|
AccessFlags
.
ACC_FINAL
);
AccessFlags
.
ACC_PUBLIC
|
AccessFlags
.
ACC_STATIC
|
AccessFlags
.
ACC_FINAL
);
c
ls
.
addInnerClass
(
newTypeCls
);
resC
ls
.
addInnerClass
(
newTypeCls
);
if
(
rClsExists
)
{
if
(
rClsExists
)
{
newTypeCls
.
addAttr
(
AType
.
COMMENTS
,
"added by JADX"
);
newTypeCls
.
addAttr
(
AType
.
COMMENTS
,
"added by JADX"
);
}
}
...
...
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
View file @
91691fbd
...
@@ -77,8 +77,7 @@ public class InputFile {
...
@@ -77,8 +77,7 @@ public class InputFile {
if
(
skipSources
)
{
if
(
skipSources
)
{
return
;
return
;
}
}
LOG
.
warn
(
"No dex files found in {}"
,
file
);
throw
new
DecodeException
(
"Unsupported input file format: "
+
file
);
}
}
private
void
addDexFile
(
Dex
dexBuf
)
{
private
void
addDexFile
(
Dex
dexBuf
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment