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
da94e7b1
Commit
da94e7b1
authored
May 27, 2017
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: update dx to 1.13 for support java 8, build for jdk 8
parent
ea346145
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
40 deletions
+16
-40
.gitignore
.gitignore
+1
-0
.travis.yml
.travis.yml
+0
-1
build.gradle
jadx-core/build.gradle
+1
-1
dx-1.13.jar
jadx-core/lib/dx-1.13.jar
+0
-0
JavaToDex.java
jadx-core/src/main/java/jadx/core/utils/files/JavaToDex.java
+14
-38
No files found.
.gitignore
View file @
da94e7b1
...
...
@@ -13,6 +13,7 @@ out/
bin/
target/
build/
classes/
idea/
.gradle/
gradle.properties
...
...
.travis.yml
View file @
da94e7b1
language
:
java
jdk
:
-
oraclejdk8
-
oraclejdk7
before_install
:
-
chmod +x gradlew
...
...
jadx-core/build.gradle
View file @
da94e7b1
...
...
@@ -3,7 +3,7 @@ ext.jadxClasspath = 'clsp-data/android-5.1.jar'
dependencies
{
runtime
files
(
jadxClasspath
)
compile
files
(
'lib/dx.jar'
)
compile
files
(
'lib/dx
-1.13
.jar'
)
compile
'commons-io:commons-io:2.4'
compile
'org.ow2.asm:asm:5.0.3'
compile
'com.intellij:annotations:12.0'
...
...
jadx-core/lib/dx-1.13.jar
0 → 100644
View file @
da94e7b1
File added
jadx-core/src/main/java/jadx/core/utils/files/JavaToDex.java
View file @
da94e7b1
package
jadx
.
core
.
utils
.
files
;
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.DxContext
;
import
com.android.dx.command.dexer.Main
;
import
com.android.dx.command.dexer.Main.Arguments
;
import
static
com
.
android
.
dx
.
command
.
dexer
.
Main
.
run
;
import
jadx.core.utils.exceptions.JadxException
;
import
static
jadx
.
core
.
utils
.
files
.
FileUtils
.
close
;
import
static
java
.
lang
.
System
.
setOut
;
public
class
JavaToDex
{
...
...
@@ -36,41 +31,22 @@ public class JavaToDex {
private
String
dxErrors
;
public
byte
[]
convert
(
String
javaFile
)
throws
JadxException
{
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
errOut
=
new
ByteArrayOutputStream
();
try
{
DxConsole
.
err
=
new
PrintStream
(
errOut
,
true
,
CHARSET_NAME
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
JadxException
(
e
.
getMessage
(),
e
);
}
PrintStream
oldOut
=
System
.
out
;
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
try
{
setOut
(
new
PrintStream
(
baos
,
true
,
CHARSET_NAME
));
DxContext
context
=
new
DxContext
(
out
,
errOut
);
DxArgs
args
=
new
DxArgs
(
"-"
,
new
String
[]{
javaFile
});
resetOutDexVar
();
run
(
args
);
}
catch
(
Throwable
e
)
{
throw
new
JadxException
(
"dx exception: "
+
e
.
getMessage
(),
e
);
}
finally
{
close
(
baos
);
System
.
setOut
(
oldOut
);
}
try
{
// errOut also contains warnings
int
result
=
(
new
Main
(
context
)).
runDx
(
args
);
if
(
result
!=
0
)
{
throw
new
JadxException
(
"Java to dex conversion error, code: "
+
result
);
}
dxErrors
=
errOut
.
toString
(
CHARSET_NAME
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
JadxException
(
"Can't save error output"
,
e
);
}
return
baos
.
toByteArray
();
}
private
void
resetOutDexVar
()
throws
JadxException
{
try
{
Field
outputDex
=
Main
.
class
.
getDeclaredField
(
"outputDex"
);
outputDex
.
setAccessible
(
true
);
outputDex
.
set
(
null
,
null
);
return
out
.
toByteArray
();
}
catch
(
Exception
e
)
{
throw
new
JadxException
(
"Failed to reset outputDex field"
,
e
);
throw
new
JadxException
(
"dx exception: "
+
e
.
getMessage
(),
e
);
}
finally
{
close
(
out
);
close
(
errOut
);
}
}
...
...
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