mmin18 / dex65536 Goto Github PK
View Code? Open in Web Editor NEWSolve the issue with dalvik compiler limitation on 65536 methods (Unable to execute dex: method ID not in [0, 0xffff]: 65536)
License: MIT License
Solve the issue with dalvik compiler limitation on 65536 methods (Unable to execute dex: method ID not in [0, 0xffff]: 65536)
License: MIT License
H:\software\dex>ant debug install run
Buildfile: H:\software\dex\build.xml
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 22.6.0
[checkenv] Installed at D:\adt-bundle-windows-x86\sdk
-setup:
[echo] Project Name: MainActivity
[gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 19.0.3
[echo] Resolving Build Target for MainActivity...
[gettarget] Project Target: Android 4.3
[gettarget] API level: 18
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: H:\software\dex\bin
[mkdir] Created dir: H:\software\dex\bin\res
[mkdir] Created dir: H:\software\dex\bin\rsObj
[mkdir] Created dir: H:\software\dex\bin\rsLibs
[mkdir] Created dir: H:\software\dex\gen
[mkdir] Created dir: H:\software\dex\bin\classes
[mkdir] Created dir: H:\software\dex\bin\dexedLibs
[echo] ----------
[echo] Resolving Dependencies for MainActivity...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'debug'...
[subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
[javac] Compiling 10 source files to H:\software\dex\bin\classes
-post-compile:
[pathtool] include H:\software\dex\libs\10k-methods.jar
[pathtool] include H:\software\dex\libs\android-support-v4.jar
[mkdir] Created dir: H:\software\dex\bin\libs.apk
[dex] Converting compiled files and external libraries into H:\software\dex\bin\libs.apk\classes.
[dx] no input files specified
[dx] usage:
[dx] dx --dex [--debug] [--verbose] [--positions=<style>] [--no-locals]
[dx] [--no-optimize] [--statistics] [--[no-]optimize-list=] [--no-strict]
[dx] [--keep-classes] [--output=] [--dump-to=] [--dump-width=]
[dx] [--dump-method=[*]] [--verbose-dump] [--no-files] [--core-library]
[dx] [--num-threads=] [--incremental] [--force-jumbo]
[dx] [--multi-dex [--main-dex-list= [--minimal-main-dex]]
[dx] [.class | .{zip,jar,apk} | ] ...
[dx] Convert a set of classfiles into a dex file, optionally embedded in a
[dx] jar/zip. Output name must end with one of: .dex .jar .zip .apk or be a directory.
[dx] Positions options: none, important, lines.
[dx] --multi-dex: allows to generate several dex files if needed. This option is
[dx] exclusive with --incremental, causes --num-threads to be ignored and only
[dx] supports folder or archive output.
[dx] --main-dex-list=: is a list of class file names, classes defined by
[dx] those class files are put in classes.dex.
[dx] --minimal-main-dex: only classes selected by --main-dex-list are to be put in
[dx] the main dex.
[dx] dx --annotool --annotation= [--element=]
[dx] [--print=]
[dx] dx --dump [--debug] [--strict] [--bytes] [--optimize]
[dx] [--basic-blocks | --rop-blocks | --ssa-blocks | --dot] [--ssa-step=]
[dx] [--width=] [.class | .txt] ...
[dx] Dump classfiles, or transformations thereof, in a human-oriented format.
[dx] dx --find-usages <file.dex>
[dx] Find references and declarations to a field or method.
[dx] declaring type: a class name in internal form, like Ljava/lang/Object;
[dx] member: a field or method name, like hashCode
[dx] dx -J ... <arguments, in one of the above forms>
[dx] Pass VM-specific options to the virtual machine that runs dx.
[dx] dx --version
[dx] Print the version of this tool (1.8).
[dx] dx --help
[dx] Print this message.
BUILD FAILED
H:\software\dex\custom_rules.xml:26: null returned: 1
i took the updated clone still i am getting the same build failed error , can u please suggest me with this .....
Hi when I am trying to add google-play-services-lib as library to this project it is saying build failed
Hi
Thanks for your ant build process.it is very much helpful to the large project(exceeds 65536 methods).but i got an issue while running the project, that is project launched successfully but my library project is not loaded properly.its getting error when accessing the library project.i have third party library project for swipe listview. its getting error when access the swipe list view view in xml. please help me for this issue.
i have mentioned the issues in below
Caused by: android.view.Inflate Exception: Binary XML file line #166: Error inflating class com.fortysevendeg.swipe list view.SwipeListView
Caused by: java.lang.NoClassDefFoundError: com.fortysevendeg.swipelistview.R$styleable
please help me
thanks in advance
I found that we must use reflect to invoke class method.
Hi,
I have downloaded the project and followed all the steps you have mentioned. i have ant installed on my system.The project was building successfully if i used just "ant" command on the root directory of the project but i get the following error if i use "ant debug" command.
BUILD FAILED
C:\Users\3124\Downloads\Reference_Materials\Dex65536-master\Dex65536\custom_rule
s.xml:26: null returned: 1.
I dont have a clue as to what is going wrong. so can someone explain what had i done wrong.
I found ant debug runs well , but when i use 'ant release', build fail, the error msg is
"Multiple dex files define ...."
i want to know the reason and how to solve it, thank you!
in the project.properties,I have some my own -keeps, when I called "android update project - p",the file "project.properties" content auto changed to
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
and the app can install normally, but it cannot open, and lots of Lcom cannot find
what i can do by this?thanks
[dx] UNEXPECTED TOP-LEVEL ERROR:
[dx] java.lang.OutOfMemoryError: GC overhead limit exceeded
BUILD FAILED
D:\workspace\ViewTest\custom_rules.xml:26: null returned: 3
Total time: 6 minutes 31 seconds
D:\workspace\ViewTest>
Sometimes the Error also went like: [dx] java.lang.OutOfMemoryError: java heap space
What's the problem about? I'need help..
I found something about sign in release ENV,but how ? below is the description in your demo(custom_rules.xml):
release: Builds the application. The generated apk file must be
signed before it is published.
The 'nodeps' target can be used to only build the
current project and ignore the libraries using:
'ant nodeps release'
PLS help me: How to use this command signature.(I already have a signature file)
i got now another error after executing the debug command pressed;
error:---
Buildfile: D:\BuzzBoard_Workspace\BuzzBoardWork\build.xml
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 22.6.3
[checkenv] Installed at D:\09114\MobileDevSoftwares\android-sdk-windows
-setup:
[echo] Project Name: SigninActivity
[gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 19.1.0
[echo] Resolving Build Target for SigninActivity...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: D:\BuzzBoard_Workspace\BuzzBoardWork\bin\rsObj
[mkdir] Created dir: D:\BuzzBoard_Workspace\BuzzBoardWork\bin\rsLibs
[echo] ----------
[echo] Resolving Dependencies for SigninActivity...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'debug'...
[subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Found Deleted Target File
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
[javac] Compiling 5 source files to D:\BuzzBoard_Workspace\BuzzBoardWork
\classes
-post-compile:
[dex] Converting compiled files and external libraries into D:\BuzzBoa
orkspace\BuzzBoardWork\bin\libs.apk\classes.dex...
[dx] no input files specified
[dx] usage:
[dx] dx --dex [--debug] [--verbose] [--positions=<style>] [--no-loc
[dx] [--no-optimize] [--statistics] [--[no-]optimize-list=<file>] [
-strict]
[dx] [--keep-classes] [--output=] [--dump-to=] [--dump-
h=]
[dx] [--dump-method=[*]] [--verbose-dump] [--no-files] [--cor
brary]
[dx] [--num-threads=] [--incremental] [--force-jumbo]
[dx] [--multi-dex [--main-dex-list= [--minimal-main-dex]]
[dx] [.class | .{zip,jar,apk} | ] ...
[dx] Convert a set of classfiles into a dex file, optionally embe
in a
[dx] jar/zip. Output name must end with one of: .dex .jar .zip .a
r be a directory.
[dx] Positions options: none, important, lines.
[dx] --multi-dex: allows to generate several dex files if needed.
s option is
[dx] exclusive with --incremental, causes --num-threads to be ign
and only
[dx] supports folder or archive output.
[dx] --main-dex-list=: is a list of class file names
asses defined by
[dx] those class files are put in classes.dex.
[dx] --minimal-main-dex: only classes selected by --main-dex-list
to be put in
[dx] the main dex.
[dx] dx --annotool --annotation= [--element=]
[dx] [--print=]
[dx] dx --dump [--debug] [--strict] [--bytes] [--optimize]
[dx] [--basic-blocks | --rop-blocks | --ssa-blocks | --dot] [--ssa-
=]
[dx] [--width=] [.class | .txt] ...
[dx] Dump classfiles, or transformations thereof, in a human-orie
format.
[dx] dx --find-usages <file.dex>
[dx] Find references and declarations to a field or method.
[dx] declaring type: a class name in internal form, like Ljava/la
bject;
[dx] member: a field or method name, like hashCode
[dx] dx -J ... <arguments, in one of the above forms>
[dx] Pass VM-specific options to the virtual machine that runs dx
[dx] dx --version
[dx] Print the version of this tool (1.8).
[dx] dx --help
[dx] Print this message.
BUILD FAILED
D:\BuzzBoard_Workspace\BuzzBoardWork\custom_rules.xml:39: null returned: 1
Total time: 2 seconds
Hi,
I have some .so files to do database encryption in my project.when apply ant task with this custom rule i got an error like
No implementation found for native Lcom.......
java.lang.UnsatisfiedLinkError: Native method not found:
how can solve this issue.how do i specify the .so files in custom rules file.please advice me.
i am helpless..
Thanks in Advance
I'm facing the problem that I'm not able to call a class packaged in a JAR, in my Application on onCreate(), after calling dexTool(). However, I can call it within my Activity.
Any suggestions?
Hello.
First of all thank you for sharing your code and build script with us, it is very helpful. I did manage to setup my projects and there are no compilation issues. But there is one thing that I cannot get my head around.
I'm using ORMLite for Android and for some reason the DatabaseHelper (extends OrmLiteSqliteOpenHelper) can't be instantiated cause the annotated model classes cannot be found.
I tried running my project using the provided build file without dexing the libraries to find out if the project would run without the dexTool class loading. It doesn't work. So the problem is not with the dexTool but has something to do with annotation of the data model classes and the build script.
I will try to figure out what is causing the annotated classes missing from the apk but I'm not very familiar with the whole Android build script so any help is appreciated. Thanks.
Brgds,
Eduard
i'm run my app, i got the question.please help me, thanks.
06-29 15:00:01.386: E/AndroidRuntime(13692): FATAL EXCEPTION: main
06-29 15:00:01.386: E/AndroidRuntime(13692): Process: com.mit.dstore, PID: 13692
06-29 15:00:01.386: E/AndroidRuntime(13692): java.lang.RuntimeException: Unable to instantiate application com.mit.dstore.engine.MyApplication: java.lang.ClassNotFoundException: Didn't find class "com.mit.dstore.engine.MyApplication" on path: DexPathList[[zip file "/data/app/com.mit.dstore-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mit.dstore-1/lib/arm, /vendor/lib, /system/lib]]
06-29 15:00:01.386: E/AndroidRuntime(13692): at android.app.LoadedApk.makeApplication(LoadedApk.java:584)
06-29 15:00:01.386: E/AndroidRuntime(13692): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4947)
06-29 15:00:01.386: E/AndroidRuntime(13692): at android.app.ActivityThread.access$1600(ActivityThread.java:187)
06-29 15:00:01.386: E/AndroidRuntime(13692): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584)
06-29 15:00:01.386: E/AndroidRuntime(13692): at android.os.Handler.dispatchMessage(Handler.java:111)
06-29 15:00:01.386: E/AndroidRuntime(13692): at android.os.Looper.loop(Looper.java:210)
06-29 15:00:01.386: E/AndroidRuntime(13692): at android.app.ActivityThread.main(ActivityThread.java:5809)
06-29 15:00:01.386: E/AndroidRuntime(13692): at java.lang.reflect.Method.invoke(Native Method)
06-29 15:00:01.386: E/AndroidRuntime(13692): at java.lang.reflect.Method.invoke(Method.java:372)
06-29 15:00:01.386: E/AndroidRuntime(13692): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113)
06-29 15:00:01.386: E/AndroidRuntime(13692): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)
06-29 15:00:01.386: E/AndroidRuntime(13692): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mit.dstore.engine.MyApplication" on path: DexPathList[[zip file "/data/app/com.mit.dstore-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mit.dstore-1/lib/arm, /vendor/lib, /system/lib]]
06-29 15:00:01.386: E/AndroidRuntime(13692): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
06-29 15:00:01.386: E/AndroidRuntime(13692): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
06-29 15:00:01.386: E/AndroidRuntime(13692): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
06-29 15:00:01.386: E/AndroidRuntime(13692): at android.app.Instrumentation.newApplication(Instrumentation.java:985)
06-29 15:00:01.386: E/AndroidRuntime(13692): at android.app.LoadedApk.makeApplication(LoadedApk.java:579)
06-29 15:00:01.386: E/AndroidRuntime(13692): ... 10 more
06-29 15:00:01.386: E/AndroidRuntime(13692): Suppressed: java.lang.NoClassDefFoundError: com.mit.dstore.engine.MyApplication
06-29 15:00:01.386: E/AndroidRuntime(13692): at dalvik.system.DexFile.defineClassNative(Native Method)
06-29 15:00:01.386: E/AndroidRuntime(13692): at dalvik.system.DexFile.defineClass(DexFile.java:226)
06-29 15:00:01.386: E/AndroidRuntime(13692): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
06-29 15:00:01.386: E/AndroidRuntime(13692): at dalvik.system.DexPathList.findClass(DexPathList.java:321)
06-29 15:00:01.386: E/AndroidRuntime(13692): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
06-29 15:00:01.386: E/AndroidRuntime(13692): ... 14 more
06-29 15:00:01.386: E/AndroidRuntime(13692): Suppressed: java.lang.ClassNotFoundException: com.mit.dstore.engine.MyApplication
06-29 15:00:01.386: E/AndroidRuntime(13692): at java.lang.Class.classForName(Native Method)
06-29 15:00:01.386: E/AndroidRuntime(13692): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
06-29 15:00:01.386: E/AndroidRuntime(13692): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
06-29 15:00:01.386: E/AndroidRuntime(13692): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
06-29 15:00:01.386: E/AndroidRuntime(13692): ... 13 more
06-29 15:00:01.386: E/AndroidRuntime(13692): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
What to change if the situation is:
Dex65536
has less than 65,536 methodsLib
has more than 65,536 methodsLib
includes other different librariesuse ant perfect, how to use maven to build?
Suppose that instead of a dex file, you have an entire APK file that you wish to run.
Since apps have more than just code: resources (strings, images,...) , the manifest, and the assets folder, this can be quite tricky.
Such a thing is done on "DevAppsDirect" app:
https://play.google.com/store/apps/details?id=com.inappsquared.devappsdirect
Could this library help in achieving this?
If so, how?
Hi,
I have project which contains more than 65k and 65k, means its contain total more than 2_65k methods.
previously when my project exceeds 65k methods that time its working fine but right now i have 2_65k methods. how to split in to one more dex file.
Please help me.
Hi , I had followed same process in my case. i am getting the error at exactly like
BUILD FAILED
D:\BuzzBoard_Workspace\BuzzBoardWork\custom_rules.xml:29: Problem: failed to
ate task or type pathtool
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any / declarations have taken place.
i used custome_rule file and did not chaged anything. i had keep as it is.
please give me sujjetion. i had waste almost one week on this 65356 method issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.