我最近接手了一个Android Studio项目的工作,该项目的活跃开发已在18个月前的2018年7月停止。
我已经能够构建该产品的调试版本,但是无法发布。该构建未能尝试构建我今天添加的新productFlavor。这是构建错误:
Multiple dex files define Landroid/support/v13/view/inputmethod/InputConnectionCompat$OnCommitContentListener;
与build.gradle同步后,将创建App模块的新版本。当我选择newFlavorDebug时,出现上述错误。我可以回到localhost风格,仍然可以构建localhostDebug并将其发送到仿真器以运行。但是,在经历了许多问题和答案之后,其中一个建议建立-> Clean Project,现在我无法构建任何样式。
一些我已经从其他答案中尝试过的东西:
dexOptions {
preDexLibraries = false
}
multiDexEnabled true
这些都没有帮助。
在上述问题上,我发现了很多变体,但对我而言却无济于事。
这是我的应用程序build.gradle中的配置和依赖项块:
// 2019-11-21 - Added this because of error during build: java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v13/view/DragAndDropPermissionsCompat.class
// This article suggested v4 - https://stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult
// This article suggested v13, but got error "error: package android.support.v13.app does not exist" - https://stackoverflow.com/questions/49553021/program-type-already-present-android-support-v13-view-draganddroppermissionscom
// This article, second answer, recommended checking duplicated dependencies in module build.gradle- https://stackoverflow.com/questions/49553021/program-type-already-present-android-support-v13-view-draganddroppermissionscom
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// This was suggested but didn't work - https://stackoverflow.com/questions/29003114/android-build-fails-over-com-android-dex-dexexception-multiple-dex-files-define
// compile fileTree(dir: 'libs', include: '*.jar', exclude: 'android-support-*.jar')
// compile 'com.braintreepayments.api:braintree:2.+'
// compile 'cards.pay:paycardsrecognizer:1.0.0'
compile 'cards.pay:paycardsrecognizer:1.1.0'
compile files('src/libs/mint-5.2.2.jar')
compile 'com.pddstudio:urlshortener:1.0.2'
compile 'io.branch.sdk.android:library:2.14.1'
compile 'com.googlecode.libphonenumber:libphonenumber:7.7.2'
compile 'com.github.twinkle942910:monthyearpicker:0.0.1'
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.github.polok.routedrawer:library:1.0.0'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.google.android.gms:play-services-gcm:12.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.prolificinteractive:material-calendarview:1.4.3'
compile 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
implementation 'br.com.moip:credit-card-validator:0.0.6'
compile 'com.wang.avi:library:2.1.3'
compile 'com.karumi:dexter:4.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.wdullaer:materialdatetimepicker:3.2.2'
compile 'com.sothree.slidinguppanel:library:3.3.1'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'org.sufficientlysecure:html-textview:3.5'
compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.android.support:support-v4:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support:design:27.1.1'
compile 'com.google.android.gms:play-services:12.0.0'
compile 'com.google.android.gms:play-services-maps:12.0.0'
compile 'com.jaredrummler:material-spinner:1.1.0'
compile 'com.google.firebase:firebase-messaging:12.0.0'
compile 'com.facebook.stetho:stetho:1.5.0'
compile 'com.amitshekhar.android:debug-db:1.0.1'
compile 'com.intuit.sdp:sdp-android:1.0.5'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'io.card:android-sdk:5.5.1'
compile 'com.github.zcweng:switch-button:0.0.3@aar'
compile 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:1.0.4'
// compile 'com.android.support:multidex:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
请注意:
compile 'com.android.support:appcompat-v7:27.1.1'
收到警告,提示某些事情要求版本27.1.1、26.1.0和25.3.1。
我已从Android Studio终端使用此命令查看依赖项列表:
./gradlew -q :app:dependencies
似乎https://github.com/polok/RouteDrawer是26.1.0的依赖源,但是它是最近5年没有更新的代码库:
+--- com.github.polok.routedrawer:library:1.0.0
| +--- com.google.code.gson:gson:2.3 -> 2.8.1
| +--- com.netflix.rxjava:rxjava-android:0.20.6
| | \--- com.netflix.rxjava:rxjava-core:0.20.6
| +--- com.squareup.okhttp:okhttp:2.0.0 -> 2.5.0
| | \--- com.squareup.okio:okio:1.6.0 -> 1.9.0
| +--- com.android.support:appcompat-v7:21.0.0 -> 27.1.1 (*)
| +--- com.google.android.gms:play-services:6.1.11 -> 12.0.0
| | +--- com.google.android.gms:play-services-ads:12.0.0
(lines deleted)
| | +--- com.google.android.gms:play-services-cast-framework:12.0.0
| | | +--- com.google.android.gms:play-services-base:12.0.0 (*)
| | | +--- com.google.android.gms:play-services-cast:12.0.0
| | | | +--- com.google.android.gms:play-services-base:12.0.0 (*)
| | | | +--- com.google.android.gms:play-services-basement:12.0.0 (*)
| | | | +--- com.google.android.gms:play-services-tasks:12.0.0 (*)
| | | | +--- com.android.support:mediarouter-v7:26.1.0
| | | | | +--- com.android.support:appcompat-v7:26.1.0 -> 27.1.1 (*)
| | | | | \--- com.android.support:palette-v7:26.1.0
| | | | | +--- com.android.support:support-compat:26.1.0 -> 27.1.1 (*)
| | | | | \--- com.android.support:support-core-utils:26.1.0 -> 27.1.1 (*)
| | | | \--- com.google.android.gms:play-services-cast-license:12.0.0
不建议使用许多编译警告,而需要用实现代替。
失败的是任务5/5:
:app:transformDexArchiveWithExternalLibsDexMergerForDemo_webmillDebug 1 s 996 ms
Execute task action 1/5 for :app:transformDexArchiveWithExternalLibsDexMergerForDemo_webmillDebug
Execute task action 2/5 for :app:transformDexArchiveWithExternalLibsDexMergerForDemo_webmillDebug
Execute task action 3/5 for :app:transformDexArchiveWithExternalLibsDexMergerForDemo_webmillDebug
Execute task action 4/5 for :app:transformDexArchiveWithExternalLibsDexMergerForDemo_webmillDebug 1 ms
Execute task action 5/5 for :app:transformDexArchiveWithExternalLibsDexMergerForDemo_webmillDebug 1 s 945 ms
以下是我在任务操作5.5中遇到的错误示例:
错误:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDemo_webmillDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at com.android.builder.dexing.DxDexArchiveMerger.mergeMultidex(DxDexArchiveMerger.java:266)
at com.android.builder.dexing.DxDexArchiveMerger.mergeDexArchives(DxDexArchiveMerger.java:133)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:97)
at com.android.build.gradle.internal.transforms.ExternalLibsMergerTransform.transform(ExternalLibsMergerTransform.kt:121)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:222)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:218)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:213)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 30 more
Caused by: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:72)
at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
... 4 more
Caused by: com.android.dex.DexException: Multiple dex files define Landroid/support/v13/view/inputmethod/InputConnectionCompat$OnCommitContentListener;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
... 6 more
因此,我一直在研究依赖性列表,并消除了com.android.support.appcompat-v7上的警告,但现在在mediarouter-v7上有一个警告。这是我最新的完整的build.gradle文件:
apply plugin: 'com.android.application'
android {
flavorDimensions "default"
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.somedev.demoApp"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// 2019/11/21 - trying to build a release build threw a lint warning, where lint suggested adding this
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
// This did not solve": Multiple dex files define Landroid/support/v13/view/DragStartHelper$OnDragStartListener;
dexOptions {
preDexLibraries = false
}
flavorDimensions "server"
productFlavors {
// This is the flavor that runs on MacBook with PHPStorm and Docker
localhost {
dimension "server"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
buildConfigField 'String', 'BASE_URL', '"http://192.168.1.117:8081/api/"'
buildConfigField 'String', 'USER_PROFILE_URL', '"http://192.168.1.117:8081/admin/file/"'
buildConfigField 'String', 'WEB_PORT', '"1738"'
buildConfigField 'String', 'COUNTRY_CODE', '"+1"'
buildConfigField 'String', 'flag', '"us"'
buildConfigField 'boolean', 'isDevelopment', 'false'
}
// This is the version to run against online server
newFlavor {
dimension "server"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
buildConfigField 'String', 'BASE_URL', '"http://demo.mywww.com/api/"'
buildConfigField 'String', 'USER_PROFILE_URL', '"http://demo.mywww.com/admin/file/"'
buildConfigField 'int', 'WEB_PORT', '80' // Doesnt seem to be used...
buildConfigField 'String', 'SERVER_URl', '"72.28.24.98"' // This seems to have to be IP address of server in BASE_URL
buildConfigField 'String', 'flag', '"us"'
buildConfigField 'boolean', 'isDevelopment', 'false'
}
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven { url "http://pay.cards/maven" }
}
}
// 2019-11-21 - Added this because of error during build: java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v13/view/DragAndDropPermissionsCompat.class
// This article suggested v4 - https://stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult
// This article suggested v13, but got error "error: package android.support.v13.app does not exist" - https://stackoverflow.com/questions/49553021/program-type-already-present-android-support-v13-view-draganddroppermissionscom
// This article, second answer, recommended checking duplicated dependencies in module build.gradle- https://stackoverflow.com/questions/49553021/program-type-already-present-android-support-v13-view-draganddroppermissionscom
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// This was suggested but didn't work - https://stackoverflow.com/questions/29003114/android-build-fails-over-com-android-dex-dexexception-multiple-dex-files-define
implementation fileTree(dir: 'libs', include: '*.jar', exclude: 'android-support-*.jar')
// compile 'com.braintreepayments.api:braintree:2.+'
// compile 'cards.pay:paycardsrecognizer:1.0.0'
implementation 'cards.pay:paycardsrecognizer:1.1.0'
implementation files('src/libs/mint-5.2.2.jar')
implementation 'com.pddstudio:urlshortener:1.0.2'
implementation 'io.branch.sdk.android:library:2.14.1'
implementation 'com.googlecode.libphonenumber:libphonenumber:7.7.2'
implementation 'com.github.twinkle942910:monthyearpicker:0.0.1'
implementation ('com.github.polok.routedrawer:library:1.0.0') {
exclude module: 'appcompat-v7'
exclude module: 'mediarouter-v7'
}
implementation 'com.android.support:mediarouter-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation ('com.wdullaer:materialdatetimepicker:3.2.2') {
// exclude module: 'mediarouter-v7'
}
implementation 'com.github.bumptech.glide:glide:3.5.2'
implementation 'com.google.android.gms:play-services-gcm:12.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.mikhaellopez:circularimageview:3.0.2'
implementation 'com.prolificinteractive:material-calendarview:1.4.3'
implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
implementation 'br.com.moip:credit-card-validator:0.0.6'
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.karumi:dexter:4.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.sothree.slidinguppanel:library:3.3.1'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'org.sufficientlysecure:html-textview:3.5'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.android.gms:play-services:12.0.0'
implementation 'com.google.android.gms:play-services-maps:12.0.0'
implementation 'com.jaredrummler:material-spinner:1.1.0'
implementation 'com.google.firebase:firebase-messaging:12.0.0'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.amitshekhar.android:debug-db:1.0.1'
implementation 'com.intuit.sdp:sdp-android:1.0.5'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'io.card:android-sdk:5.5.1'
implementation 'com.github.zcweng:switch-button:0.0.3@aar'
implementation 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:1.0.4'
// compile 'com.android.support:multidex:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
无法解决我遇到的问题的文章:
答案 0 :(得分:0)
尝试以下方法:
将此代码块添加到您的 build.gradle 文件
中df = df[req_order]
然后清理并重建您的项目。