早上好,我在编译我的应用程序时遇到Android Studio上的问题。关于应用程序我没有得到任何输出错误:transformClassesWithDexBuilderForDebug在构建时,它只是卡住并运行了太多时间。
我最近把我的项目搬到了AndroidX。
Gradle同步工作正常,所以我想这是一个编译问题,我也尝试过添加multidex但它不起作用。
这里有我的app.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.package"
minSdkVersion 21
targetSdkVersion 28
versionCode 7
versionName "1.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable "ResAuto", "MissingTranslation", "OnClick", "ExtraTranslation"
// checkReleaseBuilds false
// abortOnError false
}
aaptOptions {
additionalParameters "--shared-lib", "-I", "/example/example/apk.apk"
}
useLibrary 'android.test.runner'
useLibrary 'android.test.base'
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.google.android.material:material:1.1.0-alpha03'
implementation'com.android.support:multidex:1.0.3'
}
有什么建议吗?非常感谢。
只需删除/ YourApp和/ YourApp / app中的'build'文件夹,然后使用File > Invalidate Caches/Restart
重新启动
或打开终端和/你的应用程序。在命令下运行。 qazxsw poi
如果以上两个解决方案都不起作用,请将Java版本从7更新到8.您可以看到./gradlew clean
的答案。