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
0fff1a67
Commit
0fff1a67
authored
Mar 19, 2016
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix warning from dx library
parent
d95d268e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
InputFile.java
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
+2
-1
JavaToDex.java
jadx-core/src/main/java/jadx/core/utils/files/JavaToDex.java
+15
-1
No files found.
jadx-core/src/main/java/jadx/core/utils/files/InputFile.java
View file @
0fff1a67
...
...
@@ -121,7 +121,8 @@ public class InputFile {
byte
[]
ba
=
j2d
.
convert
(
jarFile
.
getAbsolutePath
());
if
(
ba
.
length
==
0
)
{
throw
new
JadxException
(
j2d
.
isError
()
?
j2d
.
getDxErrors
()
:
"Empty dx output"
);
}
else
if
(
j2d
.
isError
())
{
}
if
(
j2d
.
isError
())
{
LOG
.
warn
(
"dx message: {}"
,
j2d
.
getDxErrors
());
}
return
new
Dex
(
ba
);
...
...
jadx-core/src/main/java/jadx/core/utils/files/JavaToDex.java
View file @
0fff1a67
...
...
@@ -5,6 +5,7 @@ import jadx.core.utils.exceptions.JadxException;
import
java.io.ByteArrayOutputStream
;
import
java.io.PrintStream
;
import
java.io.UnsupportedEncodingException
;
import
java.lang.reflect.Field
;
import
com.android.dx.command.DxConsole
;
import
com.android.dx.command.dexer.Main
;
...
...
@@ -23,6 +24,8 @@ public class JavaToDex {
optimize
=
true
;
localInfo
=
true
;
coreLibrary
=
true
;
debug
=
true
;
}
}
...
...
@@ -40,6 +43,7 @@ public class JavaToDex {
try
{
System
.
setOut
(
new
PrintStream
(
baos
,
true
,
CHARSET_NAME
));
DxArgs
args
=
new
DxArgs
(
"-"
,
new
String
[]{
javaFile
});
resetOutDexVar
();
Main
.
run
(
args
);
baos
.
close
();
}
catch
(
Throwable
e
)
{
...
...
@@ -56,11 +60,21 @@ public class JavaToDex {
return
baos
.
toByteArray
();
}
private
void
resetOutDexVar
()
throws
JadxException
{
try
{
Field
outputDex
=
Main
.
class
.
getDeclaredField
(
"outputDex"
);
outputDex
.
setAccessible
(
true
);
outputDex
.
set
(
null
,
null
);
}
catch
(
Exception
e
)
{
throw
new
JadxException
(
"Failed to reset outputDex field"
,
e
);
}
}
public
String
getDxErrors
()
{
return
dxErrors
;
}
public
boolean
isError
()
{
return
dxErrors
!=
null
&&
dxErrors
.
length
()
>
0
;
return
dxErrors
!=
null
&&
!
dxErrors
.
isEmpty
()
;
}
}
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