Giter Site home page Giter Site logo

android-easy-multidex's People

Contributors

ceabie avatar tangxiaolv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-easy-multidex's Issues

没有任何效果

按照demo设置后,发现没有任何一点效果。然后fetch 下来demo,发现demo自己也不会分多dex。。。。

使用中遇到的问题

在实际运用中,打包后在4.2.2模拟器上运行,出现如下错误,是不是说明相关依赖没有在第一个main dex中呢,这里是极光推送的相关依赖。
thma E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at cn.jpush.android.b.a(Unknown Source)
at cn.jpush.android.b.a(Unknown Source)
at cn.jpush.android.api.JPushInterface.init(Unknown Source)
at com.ibreathcare.asthma.MyApplication.init(MyApplication.java:82)
at com.ibreathcare.asthma.MyApplication.onCreate(MyApplication.java:65)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1000)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4391)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)

找不到MainActivity

在酷派9190L android 4.3的系统上,报找不到MainActivity错误!小米5正常使用。

MultiDex issue

Hi,
My Android app crashes when it is installed from Play store while launching but when i launch the same app directly from the device, it is not crashing. So i am Assume that it will be the MultiDex issue. i am developing the games in ActionScript language so how to use MultiDex Enabled in ActionScript .

please suggest me solution as soon as possible.

不会分包

已经按照教程的配置了,
编译的时候console输出
DexKnife Processing ...
DexKnife Config: -just activity com.ctv.ui.splash.splashactivity
DexKnife Config: -keep com.ctv.sdk.**
DexKnife Config: -split .
DexKnife Config: -donot-use-suggest
DexKnife-From MergedJar: /home/alex/AndroidStudioProjects/ctv/app/build/intermediates/transforms/jarMerging/debug/jars/1/1f/combined.jar
:app:genMainDexList

DexKnife: From Merged Jar: /home/alex/AndroidStudioProjects/ctv/app/build/intermediates/transforms/jarMerging/debug/jars/1/1f/combined.jar

DexKnife Finished: 17ms

为毛还是只有一个dex, 8.3mb....

multiDexKeepFile疑问

gradle插件1.5.0以后写起来比较的麻烦。所以想着直接使用multiDexKeepFile,但是multiDexKeepFile不会导致分dex,是哪里有问题吗? 使用DexKnifePlugin是OK的。

multiDexEnabled true
multiDexKeepFile file('maindexlist.txt')

配置了

#为注释符

#-----------主Dex中必要依赖的脚本配置-----------
#默认保留四大组件中其他三大组件,Activity组件选择性保留(使用-just activity 选项),若为空默认保留所有Activity
#-just activity com.ceabie.demo.MainActivity

#-----------附加类-----------

如果你想要某个包路径在maindex中,则使用 -keep 选项,即使他已经在分包的路径中.若为空,默认保留所有

-keep com.ezviz.**

保留单个类.

#-keep android.support.v7.app.AppCompatDialogFragment.class

这条配置可以指定这个包下类在第二及其他dex中.

#android.support.v?.**
#将全部类移出主Dex
-split com.juziwl.xiaoxin.view.**
-split com.juziwl.model.**

不包含Android gradle 插件自动生成的miandex列表.(不用系统自带分包策略)

#-donot-use-suggest
#-dex-param --set-max-idx-number=4000

不进行dex分包, 直到 dex 的id数量超过 65536.(设置自动执行分包策略)

#-auto-maindex

显示miandex的日志.

#-log-mainlist

我配置了感觉并没有将类移除主包主包还是很大!!!

build 成功运行报ClassNotFoundException:Didn't find class

DexKnife Processing ...
DexKnife Adt Main: null
DexKnife Config: -dex-param --set-max-idx-number=4000
DexKnife Config: -auto-maindex
DexKnife Config: -log-mainlist

DexKnife Warning: NO SET split Or keep path, it will use Suggest!

DexKnife-From MergedJar: null
DexKnife Error: jarMerging is Null! Skip DexKnife. Please report All Gradle Log.
DexKnife Finished: 7ms

新問題, 如何生成多個包?

使用這個插件,主包的大小降下來了,1.5mb左右,但是第二個包卻有7mb, 如何保證每個包小於4mb?因爲要兼容android 2.x, 所以也就是是否可以生成第三個包?

dexknife.txt相关问题

为注释符

-----------主Dex中必要依赖的脚本配置-----------

默认保留四大组件中其他三大组件,Activity组件选择性保留(使用-just activity 选项),若为空默认保留所有Activity

-just activity com.ceabie.demo.MainActivity

这个是指

-just activity com.ceabie.demo.MainActivity(注释掉或者不写)

还是-just activity(选项不写)?用来保留所有的Activity?

将全部类移出主Dex

-split .
上面这个选项是不是不包括四大组件?它跟下面一条有冲突吗?

这条配置可以指定这个包下类在第二及其他dex中.

android.support.v?.**

显示miandex的日志.

-log-mainlist

这个日志是在哪里显示?

如果是有多个依赖module是不是在主app中使用?
谢谢!

建议支持指定分在dex2或dex3中的功能

我现在的项目有三个dex,按照dexknife的配置,只能明确指定一个类在主dex,而其他的类会随机分配在dex2和dex3中,大神这个项目能够增加明确指定某些类只分配在某一个dex(非主dex)中功能吗?

找不到MainActivity

我已经写了-just activity asia.bluepay.best.pay.MainActivity,关闭了instant run,gradle版本是2.1.0,在坚果1上测试MainActivity没有打进主dex包中,如果单保留MainActivity.class,MainActivity中的内部类找不到

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

配置后报错

`DexKnife Processing ...
DexKnife Config: -keep com.efangtec.efang.**
DexKnife Config: -donot-use-suggest
DexKnife Config: -auto-maindex
:app:genMainDexList
DexKnife: From Merged Jar: null
DexKnife: The Merged Jar is not exist! Can't be processed!
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

DexKnife Warnning: Main dex is EMPTY ! Check your config and project!`

我的方法数没有超过65535,但是我想要分包,请问怎么操作?


build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'dexknifePlus'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "com.juziwl.ixiao"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"

    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}
dexKnife{
//必选参数
enabled true //if false,禁用分包插件
//可选参数
//1.如果没有可选参数,将根据enabled决定是否分包。
//2.如果有可选参数,需满足必选参数和可选参数的条件才允许分包
productFlavor 'mock'
buildType 'debug'

/*
*eg:当前productFlavors = dev,buildType = debug,
*参数组合1:enabled = true,productFlavor = dev,buildType = debug 分包
*参数组合2:enabled = true,productFlavor = mock,buildType = debug 不分包
*参数组合1:enabled = true,buildType = debug 所有buildType = debug分包
*参数组合1:enabled = true,productFlavor = dev 所有productFlavor = dev分包
* */

}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'io.reactivex:rxjava:1.1.5'
compile 'io.reactivex:rxandroid:1.2.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.hwangjr.rxbus:rxbus:1.0.4'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.github.Aspsine:SwipeToLoadLayout:1.0.3'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.android.support:multidex:1.0.1'
}

dexknife.txt
#为注释符

#-----------主Dex中必要依赖的脚本配置-----------
#默认保留四大组件中其他三大组件(并计算其依赖树),Activity组件选择性保留(使用-just activity 选项),若为空不保留任何Activity
-just activity com.juziwl.ixiao.main.MainActivity

#-----------附加类-----------

如果你想要某个包路径在maindex中,则使用 -keep 选项,即使他已经在分包的路径中.若为空,不保留任意类

#-keep com.ceabie.demo.**

保留单个类.

#-keep android.support.v7.app.AppCompatDialogFragment.class

这条配置可以指定这个包下类在第二及其他dex中.

#-split android.support.v?.**
#将全部类移出主Dex
-split .

不包含Android gradle 插件自动生成的miandex列表.(不使用建议的依赖树,注释掉表示使用,否则-just activity无效)

#-donot-use-suggest

(分割每个dex的方法数上限) 扩展参数:例如 --set-max-idx-number=50000

如果出现 DexException: Too many classes in --main-dex-list, main dex capacity exceeded:

表明限制的方法数小于main dex的必要方法数,调大到合适数值即可

-dex-param --set-max-idx-number=3000

不进行dex分包, 直到 dex 的id数量超过 65536.(设置自动执行分包策略)

#-auto-maindex

显示miandex的日志.

#-log-mainlist

打包的时候还报了一些错,但是打包成功了
Information:Gradle tasks [:emojitest:assembleDebug, :ixiao:assembleDebug]
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.squareup.haha.guava.base.Joiner$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.squareup.haha.guava.collect.Iterables$2) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(com.squareup.haha.guava.collect.Iterables$3) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class.
Information:BUILD SUCCESSFUL
Information:Total time: 43.909 secs
Information:24 errors
Information:0 warnings
Information:See complete output in console

我生成class.dex文件有27928个方法,我现在就想分包,请问怎么写?还有上面的问题是什么原因造成的?

Could not find com.ceabie.dextools:gradle-dexknife-plugin:2.0.1.

Error:Could not find com.ceabie.dextools:gradle-dexknife-plugin:2.0.1. Searched in the following locations: file:/Applications/Android Studio2.2.app/Contents/gradle/m2repository/com/ceabie/dextools/gradle-dexknife-plugin/2.0.1/gradle-dexknife-plugin-2.0.1.pom file:/Applications/Android Studio2.2.app/Contents/gradle/m2repository/com/ceabie/dextools/gradle-dexknife-plugin/2.0.1/gradle-dexknife-plugin-2.0.1.jar https://jcenter.bintray.com/com/ceabie/dextools/gradle-dexknife-plugin/2.0.1/gradle-dexknife-plugin-2.0.1.pom https://jcenter.bintray.com/com/ceabie/dextools/gradle-dexknife-plugin/2.0.1/gradle-dexknife-plugin-2.0.1.jar file:/Users/allen/AndroidStudioProjects/juyoulicai_android_app/repo/com/ceabie/dextools/gradle-dexknife-plugin/2.0.1/gradle-dexknife-plugin-2.0.1.pom file:/Users/allen/AndroidStudioProjects/juyoulicai_android_app/repo/com/ceabie/dextools/gradle-dexknife-plugin/2.0.1/gradle-dexknife-plugin-2.0.1.jar Required by: :juyoulicai_android_app:unspecified

Error:Failed to resolve: annotationProcessor

直接用了您的那段引用 : compile 'com.android.support:MultiDex:1.0.1'

一直报错,后来才发现 compile 'com.android.support:multidex:1.0.1' 全是小写字母。

无法启动APP

友盟中的类无法找到 我没有做混淆如将分包插件关闭可以正常启动应用这个是怎么回事呢
Could not find class 'com.taobao.accs.utl.h$a', referenced from method com.taobao.accs.internal.ACCSManagerImpl.bindApp Could not find class 'com.ut.mini.internal.UTOriginalCustomHitBuilder', referenced from method com.taobao.accs.utl.UTMini.commitEvent
环信也报错
'com.hyphenate.chat.EMCallManager', referenced from method com.hyphenate.chat.EMClient.callManager

和Tinker 不兼容

DexKnife Processing ...
:NewTravelGuide_main:transformClassesWithDexForDevDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':NewTravelGuide_main:transformClassesWithDexForDevDebug'.

Cannot cast object 'com.tencent.tinker.build.gradle.transform.ImmutableDexTransform@5dd422d6' with class 'com.tencent.tinker.build.gradle.transform.ImmutableDexTransform' to class 'com.android.build.gradle.internal.transforms.DexTransform'

just activity 不支持gradle 2.2.3?

private static void filterActivity(Project project) { File file = project.file(DexSplitTools.DEX_KNIFE_CFG_TXT) if (file != null) { def justActivitys = []; file.eachLine { line -> //printf "read line ${line}\n"; if (line.startsWith('-just activity')) { line = line.replaceAll('-just activity', '').trim(); justActivitys.add(line) } } printf "-just activity size = ${justActivitys.size()}\n"; if (justActivitys.size() != 0) { project.tasks.each { task -> if (task.name.startsWith('collect') && task.name.endsWith('MultiDexComponents')) { println "main-dex-filter: found task $task.name" task.filter { name, attrs -> String componentName = attrs.get('android:name') if ('activity'.equals(name)) { def result = justActivitys.find { componentName.endsWith("${it}") } def bool = result != null; if (bool) { printf "main-dex-filter: keep ${componentName}\n" } return bool } return true } } } } } }
在gradle2.2.3中没有collectReleaseMultiDexComponents

java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

08-29 17:21:17.634 31325-31325/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: xx, PID: 31325
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{xx/xxx.SplashActivity}: java.lang.ClassNotFoundException: Didn't find class "xxx.SplashActivity" on path: DexPathList[[zip file "/data/app/xx-1/base.apk"],nativeLibraryDirectories=[/data/app/xx-1/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2252)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2403)
at android.app.ActivityThread.access$800(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5298)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:910)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:705)
Caused by: java.lang.ClassNotFoundException: Didn't find class "cn.v6.sixrooms.ui.phone.SplashActivity" on path: DexPathList[[zip file "/data/app/xx-1/base.apk"],nativeLibraryDirectories=[/data/app/xx-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1066)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2242)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2403) 
at android.app.ActivityThread.access$800(ActivityThread.java:154) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5298) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:910) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:705) 
Suppressed: java.lang.NoClassDefFoundError: xxx..SplashActivity
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 14 more
Suppressed: java.lang.ClassNotFoundException: xxx..SplashActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.