我在我的应用程序中启用了miltidex。 Api 21+工作正常。 的Android API 16原因:Android butterlitife multidex
java.lang.NoClassDefFoundError: ......AuthorizationController
如果我评论BN结合一切工作正常。 启用Multidex:multiDexEnabled true, compile 'com.android.support:multidex:1.0.1'
等等。 有什么办法可以使它工作吗?
编辑
gradle这个
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
signingConfigs {
prod_release {
...
}
}
compileSdkVersion 25
buildToolsVersion "25.0.3"
productFlavors {
dev {
// Enable pre-dexing to produce an APK that can be tested on
// Android 5.0+ without the time-consuming DEX build processes.
minSdkVersion 16
signingConfig signingConfigs.prod_release
}
prod {
// The actual minSdkVersion for the production version.
minSdkVersion 16
signingConfig signingConfigs.prod_release
}
}
defaultConfig {
applicationId "ru.wearemad.gravo"
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dexOptions {
javaMaxHeapSize "2g"
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.prod_release
}
debug {
signingConfig signingConfigs.prod_release
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.google.code.findbugs'
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
//retrofit
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
//rxjava 2
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.1.1'
//butterknife
compile 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
//mosby + conductor
compile 'com.bluelinelabs:conductor-support:2.1.4'
compile 'com.hannesdorfmann.mosby3:mvp-conductor:3.0.0'
compile 'com.hannesdorfmann.mosby3:viewstate:3.0.4'
compile 'com.hannesdorfmann.mosby3:viewstate-conductor:3.0.0'
compile 'com.madgag.spongycastle:core:1.54.0.0'
compile 'com.madgag.spongycastle:prov:1.54.0.0'
compile 'com.madgag.spongycastle:pkix:1.54.0.0'
compile 'com.madgag.spongycastle:pg:1.54.0.0'
// testCompile 'junit:junit:4.12'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.orhanobut:hawk:1.+'
compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
transitive = true;
}
compile 'com.android.support:multidex:1.0.1'
}
清单的一部分:
<application
android:name="ru.wearemad.gravo.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
应用类:
public class MyApplication extends MultiDexApplication {...}
我试图添加multiDexKeepProguard
,但是gradle没有看到该方法,或者方法的声明已更改。
编辑2 Butterknife Unbinder
其在Bitterknife.bind(
返回)使得麻烦。任何想法如何解决?
我已经尝试了这些方法:尝试了我自己的应用程序类,它扩展了MultiDexApplication和super.attachBaseContext(base); MultiDex.install(this); – TooLazy
并在Manifest中注册? –
ofc,我还有其他一些代码。 – TooLazy