gpt4 book ai didi

Android build java.lang.NullPointerException (无错误信息) org.gradle.api.ProjectConfigurationException BUILD FAILED

转载 作者:太空狗 更新时间:2023-10-29 13:07:10 26 4
gpt4 key购买 nike

这个 android 项目在 Windows 机器上创建,设置 MacOS 构建机器并从 Git 获取文件夹并在 Mac 中构建它。

这是我在mac上执行gradle时出现的问题。org.gradle.api.ProjectConfigurationException:配置项目“:app”时出现问题是发生错误。

/gradlew tasks --stacktrace
Observed package id 'build-tools;25.0.2' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/build-tools/25.0.2' (Expected '/usr/local/Caskroom/android-sdk/build-tools/25.0.2')
Observed package id 'build-tools;26.0.1' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/build-tools/26.0.1' (Expected '/usr/local/Caskroom/android-sdk/build-tools/26.0.1')
Observed package id 'emulator' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/emulator' (Expected '/usr/local/Caskroom/android-sdk/emulator')
Observed package id 'extras;android;m2repository' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/extras/android/m2repository' (Expected '/usr/local/Caskroom/android-sdk/extras/android/m2repository')
Observed package id 'extras;google;m2repository' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/extras/google/m2repository' (Expected '/usr/local/Caskroom/android-sdk/extras/google/m2repository')
Observed package id 'extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2' (Expected '/usr/local/Caskroom/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2')
Observed package id 'extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.2' (Expected '/usr/local/Caskroom/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.2')
Observed package id 'patcher;v4' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/patcher/v4' (Expected '/usr/local/Caskroom/android-sdk/patcher/v4')
Observed package id 'platform-tools' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/platform-tools' (Expected '/usr/local/Caskroom/android-sdk/platform-tools')
Observed package id 'platforms;android-25' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/platforms/android-25' (Expected '/usr/local/Caskroom/android-sdk/platforms/android-25')
Observed package id 'platforms;android-26' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/platforms/android-26' (Expected '/usr/local/Caskroom/android-sdk/platforms/android-26')
Observed package id 'tools' in inconsistent location '/usr/local/Caskroom/android-sdk/3859397,26.0.1/tools' (Expected '/usr/local/Caskroom/android-sdk/tools')

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> java.lang.NullPointerException (no error message)

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:89)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:76)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$000(LifecycleProjectEvaluator.java:33)
at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:53)
at org.gradle.configuration.project.LifecycleProjectEvaluator$1.execute(LifecycleProjectEvaluator.java:50)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:628)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:129)
at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:62)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
at org.gradle.initialization.DefaultGradleLauncher$1.execute(DefaultGradleLauncher.java:161)
at org.gradle.initialization.DefaultGradleLauncher$1.execute(DefaultGradleLauncher.java:158)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:158)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)
at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:210)
at com.google.common.collect.ImmutableCollection$ArrayBasedBuilder.add(ImmutableCollection.java:339)
at com.google.common.collect.ImmutableList$Builder.add(ImmutableList.java:652)
at com.android.builder.sdk.DefaultSdkLoader.updateRepositories(DefaultSdkLoader.java:470)
at com.android.build.gradle.internal.DependencyManager.collectArtifacts(DependencyManager.java:501)
at com.android.build.gradle.internal.DependencyManager.resolveConfiguration(DependencyManager.java:354)
at com.android.build.gradle.internal.DependencyManager.resolveDependencies(DependencyManager.java:263)
at com.android.build.gradle.internal.DependencyManager.resolveDependencies(DependencyManager.java:166)
at com.android.build.gradle.internal.TaskManager.resolveDependencies(TaskManager.java:375)
at com.android.build.gradle.internal.VariantManager.lambda$createVariantData$3(VariantManager.java:607)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.internal.VariantManager.createVariantData(VariantManager.java:603)
at com.android.build.gradle.internal.VariantManager.createVariantDataForProductFlavors(VariantManager.java:793)
at com.android.build.gradle.internal.VariantManager.populateVariantDataList(VariantManager.java:487)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:263)
at com.android.build.gradle.BasePlugin.lambda$createAndroidTasks$6(BasePlugin.java:601)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:596)
at com.android.build.gradle.BasePlugin.lambda$null$4(BasePlugin.java:526)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.BasePlugin.lambda$createTasks$5(BasePlugin.java:522)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy16.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:82)
... 56 more


BUILD FAILED

Total time: 9.926 secs

最佳答案

我在使用 JDK9(特别是 9.0.4)时遇到过这个问题。当我切换回 JDK8 时,gradle 命令成功了。这是一个使用 Gradle 4.4 构建的项目,目标 SDK 27 并使用 JavaVersion.VERSION_1_8 的源和目标兼容性。当我将它们切换回 1.7 兼容性时,问题就消失了。

关于Android build java.lang.NullPointerException (无错误信息) org.gradle.api.ProjectConfigurationException BUILD FAILED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46387403/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com