web-dev-qa-db-de.com

projekt ': app' konnte nicht gefunden werden

Mein Android Gradle-Build schlägt mit einer hilfreichen Fehlermeldung fehl

$ gradle

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> failed to find Build Tools revision 24.4.1

Ich habe mir die SDK-Version angesehen, die Android Studio für installiert hält.

 enter image description here

Es meldet, dass ich 24.4.1 installiert habe, was mit meiner build.gradle-Datei übereinstimmt. 

Ich habe auch versucht, die sdk mit ./Android list sdk -a; ./Android update sdk -a -u -t 1 zu installieren, aber der Fehler bleibt bestehen.

Ich habe sogar versucht, eine falsche local.properties-Datei zu erstellen

sdk.dir=/home/admin/DEADBEEF

was gibt

$ gradle

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/home/admin/DEADBEEF' does not exist.

Außerdem scheint der Stacktrace keine große Hilfe zu sein, da ich diese Quelldatei nicht gefunden habe. Nun habe ich angefangen, durch die googlesource für DefaultSdkLoader zu graben.

$ gradle --stacktrace

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> failed to find Build Tools revision 24.4.1

* 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:79)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.Java:74)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.Java:61)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.Java:510)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.Java:90)
        at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.Java:47)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.Java:35)
        at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.Java:125)
        at org.gradle.internal.Factories$1.create(Factories.Java:22)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:52)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.Java:122)
        at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.Java:32)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.Java:99)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.Java:93)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:62)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.Java:93)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.Java:82)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.Java:94)
        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:43)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.Java:28)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.Java:78)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.Java:48)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.Java:52)
        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:37)
        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.health.DaemonHealthTracker.execute(DaemonHealthTracker.Java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.Java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.Java:66)
        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.health.HintGCAfterBuild.execute(HintGCAfterBuild.Java:41)
        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:246)
        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.IllegalStateException: failed to find Build Tools revision 24.4.1
        at com.Android.builder.sdk.DefaultSdkLoader.getTargetInfo(DefaultSdkLoader.Java:93)
        at com.Android.build.gradle.internal.SdkHandler.initTarget(SdkHandler.Java:89)
        at com.Android.build.gradle.BasePlugin.ensureTargetSetup(BasePlugin.Java:673)
        at com.Android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.Java:610)
        at com.Android.build.gradle.BasePlugin$10$1.call(BasePlugin.Java:566)
        at com.Android.build.gradle.BasePlugin$10$1.call(BasePlugin.Java:563)
        at com.Android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.Java:55)
        at com.Android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.Java:47)
        at com.Android.build.gradle.BasePlugin$10.execute(BasePlugin.Java:562)
        at com.Android.build.gradle.BasePlugin$10.execute(BasePlugin.Java:559)
        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.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.Java:93)
        at com.Sun.proxy.$Proxy10.afterEvaluate(Unknown Source)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.Java:67)
        ... 52 more

Bevor DefaultSdkLoader ein Build-Tool zum Kompilieren des Projekts verwenden kann, 

com.Android.sdklib.repository.local.LocalSdk#scanBuildTools

wird über Ihr SDK-Verzeichnis aufgerufen. Eine neue BuildToolInfo wird erstellt, die PKG_BUILD_TOOLS-Typ verwendet, um Build-Tools zu finden. Also habe ich einfach in meinem Build-Tools-Ordner in meinem Android-SDK nachgesehen und, siehe da! Es gibt keine Build-Tools für 24.4.1

7
activedecay

Dies geschieht, weil die Version 24.4.1 von Build Tools nicht existiert.

Die neueste Version ist 23.0.2.
Diese Tools sind im SDK-Paket enthalten und werden im Verzeichnis <sdk>/build-tools/ installiert.

Verwechseln Sie nicht die Android SDK Tools mit SDK Build Tools .

Ändern Sie in Ihrem build.gradle

Android {
   buildToolsVersion "23.0.2"
   // ...

}
11

Ich habe herausgefunden, dass dies auch der Fall ist, wenn Sie einige Pakete aus Ihrem Projekt reaktiver Natur deinstalliert haben und sich noch Pakete in den Abhängigkeiten von Build Gradle im unteren Seitenbereich befinden.

{
 project(':react-native-sound-player')
}
2
Berke

Für mich war dataBinding {enabled true} in Gradle aktiviert. Das Entfernen half mir

1
J.Doe

Ich hatte C++ - Codes in meinem Projekt, aber ich hatte NDK nicht installiert, es zu installieren löste das Problem

1
Ebrahim Karimi

versuchen Sie auch, die Gradle-Version in build.gradle Ihres Projekts zu erhöhen. Ich habe mir geholfen

1
kazimad