我尝试按照指南使用 BeeWare 制作一个 android 应用程序。该应用程序只是简单的模板,因此我没有对其进行任何修改,但是自从我第一次尝试以来,我遇到了无数异常,我能够解决这些异常以查找解决方案,除了我试图查找的最后一个像我对前一个所做的那样进行修复,但我发现的任何可能的解决方案都没有奏效。
我尝试使用 Python 虚拟环境和 Android Studio 从 Visual Code 的 bash 启动它,结果相同......
控制台错误日志:
:transformClassesWithDexBuilderForDebug FAILED
com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Java\Visual Basic Code\source\mirror 4.0\ABSOLUTE5\HomeTheater\android\build\intermediates\transforms\desugar\debug\0
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 com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:306)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:221)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:217)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:212)
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.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ResolveBuildCacheKeyExecuter.execute(ResolveBuildCacheKeyExecuter.java:66)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
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:256)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:596)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
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: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Java\Visual Basic Code\source\mirror 4.0\ABSOLUTE5\HomeTheater\android\build\intermediates\transforms\desugar\debug\0
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:803)
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.lambda$convertToDexArchive$8(DexArchiveBuilderTransform.java:728)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
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.DexArchiveBuilderException: Error while dexing.
at com.android.builder.dexing.D8DexArchiveBuilder.getExceptionToRethrow(D8DexArchiveBuilder.java:169)
at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:146)
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:798)
... 6 more
Caused by: java.lang.NullPointerException
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:598)
at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
at com.android.tools.r8.utils.ThreadUtils.awaitFutures(ThreadUtils.java:21)
at com.android.tools.r8.ir.conversion.IRConverter.convertClassesToDex(IRConverter.java:315)
at com.android.tools.r8.ir.conversion.IRConverter.convertToDex(IRConverter.java:225)
at com.android.tools.r8.D8.optimize(D8.java:187)
at com.android.tools.r8.D8.run(D8.java:158)
at com.android.tools.r8.D8.lambda$run$1(D8.java:91)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:58)
at com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:45)
at com.android.tools.r8.D8.run(D8.java:88)
at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:144)
... 7 more
Suppressed: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
... 17 more
[CIRCULAR REFERENCE:java.lang.NullPointerException]
Caused by: java.lang.NullPointerException
at com.android.tools.r8.ir.conversion.JarState.readLocal(JarState.java:556)
at com.android.tools.r8.ir.conversion.JarSourceCode.updateState(JarSourceCode.java:1609)
at com.android.tools.r8.ir.conversion.JarSourceCode.updateState(JarSourceCode.java:1125)
at com.android.tools.r8.ir.conversion.JarSourceCode.computeBlockEntryJarStates(JarSourceCode.java:442)
at com.android.tools.r8.ir.conversion.JarSourceCode.buildPrelude(JarSourceCode.java:366)
at com.android.tools.r8.ir.conversion.IRBuilder.build(IRBuilder.java:362)
at com.android.tools.r8.graph.JarCode.internalBuild(JarCode.java:149)
at com.android.tools.r8.graph.JarCode.internalBuildWithLocals(JarCode.java:126)
at com.android.tools.r8.graph.JarCode.buildIR(JarCode.java:101)
at com.android.tools.r8.graph.DexEncodedMethod.buildIR(DexEncodedMethod.java:221)
at com.android.tools.r8.ir.conversion.IRConverter.rewriteCode(IRConverter.java:516)
at com.android.tools.r8.ir.conversion.IRConverter.convertMethodToDex(IRConverter.java:324)
at com.android.tools.r8.graph.DexClass.forEachMethodThrowing(DexClass.java:133)
at com.android.tools.r8.ir.conversion.IRConverter.lambda$convertClassesToDex$2(IRConverter.java:311)
... 5 more
我的'build.gradle'
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
}
}
task buildPythonDebug << {
exec {
commandLine "voc -v -p app -o build/intermediates/classes/debug app".split()
}
exec {
commandLine "voc -v -p app_packages -o build/intermediates/classes/debug app_packages".split()
}
}
task buildPythonRelease << {
exec {
commandLine "voc -v -p app -o build/intermediates/classes/release app".split()
}
exec {
commandLine "voc -v -p app_packages -o build/intermediates/classes/release app_packages".split()
}
}
task run << {
exec {
commandLine "adb shell am start -n com.homesmart.HomeTheater/android.Saibbo".split()
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
project.afterEvaluate {
packageDebug.dependsOn buildPythonDebug
packageRelease.dependsOn buildPythonRelease
run.dependsOn installDebug
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:25.1.1'
}
repositories {
google()
}
更多细节
com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Java\Visual Basic Code\source\mirror 4.0\ABSOLUTE5\HomeTheater\android\build\intermediates\transforms\desugar\debug\0
> com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Java\Visual Basic Code\source\mirror 4.0\ABSOLUTE5\HomeTheater\android\build\intermediates\transforms\desugar\debug\0
> com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Java\Visual Basic Code\source\mirror 4.0\ABSOLUTE5\HomeTheater\android\build\intermediates\transforms\desugar\debug\0
> Failed to process C:\Java\Visual Basic Code\source\mirror 4.0\ABSOLUTE5\HomeTheater\android\build\intermediates\transforms\desugar\debug\0
> Error while dexing.
> (No message provided)
> (No message provided)
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':transformClassesWithDexBuilderForDebug'.Open stacktrace
Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Java\Visual Basic Code\source\mirror 4.0\ABSOLUTE5\HomeTheater\android\build\intermediates\transforms\desugar\debug\0Open stacktrace
Caused by: com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Java\Visual Basic Code\source\mirror 4.0\ABSOLUTE5\HomeTheater\android\build\intermediates\transforms\desugar\debug\0Open stacktrace
Caused by: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Java\Visual Basic Code\source\mirror 4.0\ABSOLUTE5\HomeTheater\android\build\intermediates\transforms\desugar\debug\0Open stacktrace
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Java\Visual Basic Code\source\mirror 4.0\ABSOLUTE5\HomeTheater\android\build\intermediates\transforms\desugar\debug\0Open stacktrace
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.Open stacktrace
Caused by: java.lang.NullPointerException: (No message provided)Open stacktrace
Caused by: java.lang.NullPointerException: (No message provided)Close stacktrace
at com.android.tools.r8.ir.conversion.JarState.readLocal(JarState.java:556)
at com.android.tools.r8.ir.conversion.JarSourceCode.updateState(JarSourceCode.java:1609)
at com.android.tools.r8.ir.conversion.JarSourceCode.updateState(JarSourceCode.java:1125)
at com.android.tools.r8.ir.conversion.JarSourceCode.computeBlockEntryJarStates(JarSourceCode.java:442)
at com.android.tools.r8.ir.conversion.JarSourceCode.buildPrelude(JarSourceCode.java:366)
at com.android.tools.r8.ir.conversion.IRBuilder.build(IRBuilder.java:362)
at com.android.tools.r8.graph.JarCode.internalBuild(JarCode.java:149)
at com.android.tools.r8.graph.JarCode.internalBuildWithLocals(JarCode.java:126)
at com.android.tools.r8.graph.JarCode.buildIR(JarCode.java:101)
at com.android.tools.r8.graph.DexEncodedMethod.buildIR(DexEncodedMethod.java:221)
at com.android.tools.r8.ir.conversion.IRConverter.rewriteCode(IRConverter.java:516)
at com.android.tools.r8.ir.conversion.IRConverter.convertMethodToDex(IRConverter.java:324)
at com.android.tools.r8.graph.DexClass.forEachMethodThrowing(DexClass.java:133)
at com.android.tools.r8.ir.conversion.IRConverter.lambda$convertClassesToDex$2(IRConverter.java:311)
Gradle 4.7,构建扫描插件 1.13,Android Gradle 插件 3.1.1