我最近不得不在我的android工作室项目中启用multidex,这是用导入模块构建的。它在主要项目中做得很好,但在用导入(从主项目)模块构建的项目中显示了多重索引问题。我跟踪了这文档以启用multidex。因为application标记没有被重写,所以我遵循了与方法相关的方法。现在我得到了这个错误:
任务':app:transformClassesWithMultidexlistForDebug'.执行失败java.io.IOException:不会写E:\something\SalesDemo >Updated\app\build\intermediates\multi-dex\debug\componentClasses.jar
这是我的build.gradle
apply plugin: 'com.android.application'
//noinspection GroovyMissingReturnStatement
android {
compileSdkVersion 25
// buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.abc.def.somethingotherthing"
multiDexEnabled true
minSdkVersion 16
//noinspection OldTargetApi
targetSdkVersion 22
versionCode 16
versionName "0.0.16"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//implementation 'com.android.support:multidex:1.0.3'
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.3'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'joda-time:joda-time:2.3'
compile 'com.google.android.gms:play-services-location:10.2.0'
compile project(':infolinkplus')
}和manifest文件:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.abc.def.somethingotherthing">
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
...
//ACTIVITIES AND META-TAGS
...
</application>
</manifest>更改后,我运行干净的构建和重建,但没有结果。我怎样才能克服这个问题?提前谢谢。
发布于 2018-07-11 09:45:25
您必须更改您的Manifest以提供MultiDex
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>或者,如果您有自定义Application类,则必须使用MultiDexApplication对其进行扩展。
public class MyApplication extends MultiDexApplication { ... }发布于 2018-07-11 09:56:38
重复zip条目com/abc/def/ome.class
在您的项目中,必须有一个名为some.class的类,将其重命名为其他类。
发布于 2018-07-11 09:59:02
试试这个密码..。我希望你做了这件事。
multiDexEnabled true
compile 'com.android.support:multidex:1.0.1'为应用程序级别创建类。
public class MyApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
}
}
android:name="MyApplication" > // here define that class name that extends by MultiDexApplicationhttps://stackoverflow.com/questions/51282126
复制相似问题