我已将Android工作室更新为Android 3.1.1,更新后我试图运行我的应用程序,但它给了我app:transformClassesWithMultidexlistForDebug
例外。
我已尝试以下方法来解决错误1.
清理并重建
2.增加了multidex支持
3.使缓存无效并重新启动
4.将compiledVersion改为21
但错误仍在继续。我发布这个问题bcoz我现在离开零选项请帮我摆脱这个错误。
:app:transformClassesWithMultidexlistForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 37s
41 actionable tasks: 38 executed, 3 up-to-date
app level gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.lenovo.jdstudio"
minSdkVersion 19
targetSdkVersion 27
versionCode 19
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
dexOptions {
javaMaxHeapSize "4g"
keepRuntimeAnnotatedClasses false
}
}
buildTypes {
release {
minifyEnabled true
multiDexKeepFile file('multidex-config.txt')
multiDexKeepProguard file('multidex-config.pro')
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(':sdkuii')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
// implementation 'com.android.support:cardview-v7:27.1.0'
// implementation 'com.android.support:support-vector-drawable:27.1.0'
// implementation 'com.android.support:recyclerview-v7:27.1.0'
// implementation 'com.android.support:customtabs:27.1.0'
}
repositories {
mavenCentral()
maven {
url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:27.1.0'
//glide library
implementation 'com.github.bumptech.glide:glide:4.5.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.5.0'
implementation 'com.android.support:multidex:1.0.3'
testImplementation 'junit:junit:4.12'
// androidTestImplementation 'com.android.support.test:runner:1.0.1'
// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:design:27.1.0'
//firebase support library
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
//firebase-UI support library
implementation 'com.firebaseui:firebase-ui-database:3.1.3'
implementation 'com.firebaseui:firebase-ui-auth:3.2.1'
//CardView and RecyclerView library
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
//Image cropper
// implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
//Butter knife
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// https://mvnrepository.com/artifact/javax.mail/mail
//implementation group: 'javax.mail', name: 'mail', version: '1.4.1'
// compile files('libs/activation.jar')
// compile files('libs/additionnal.jar')
// compile files('libs/mail.jar')
}
apply plugin: 'com.google.gms.google-services'
}
AndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.lenovo.jdstudio">
<!-- Permission for CropImageTool -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Permission for Internet -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!--android:name=".JDStudio"-->
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/JDStudioTheme"
android:name="android.support.multidex.MultiDexApplication" >
<activity
android:name=".MainActivity"
android:theme="@style/JDStudioTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- CropImageActivity -->
<!--<activity-->
<!--android:name="com.theartofdev.edmodo.cropper.CropImageActivity"-->
<!--android:theme="@style/Base.Theme.AppCompat" />-->
<activity android:name=".RegisterActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".SetupActivity" />
<activity android:name=".UserMainActivity" />
<activity android:name=".AdminMainActivity" />
<activity android:name=".IndividualProduct" />
<activity android:name=".ShoppingCartWindow" />
<activity android:name=".SchedulingActivity" />
<activity android:name=".UpdateOrderStatusActivity"/>
</application>
</manifest>
progurg-rules.pro
-keep class com.example.lenovo.jdstudio
答案 0 :(得分:0)
最后,我按照步骤
解决了错误 1.删除项目中未使用的文件
2.clean
3.Rebuild 强>
繁荣项目运行......