No toolchains found in the NDK toolchains folder f

2019-08-26 07:47发布

问题:

I had a working project, but there was some problem with Android studio displaying the breakpoints, so I uninstalled the Android Studio on my mac, reinstalled it and opened the same working project. Strangely it gives the below error and I cant do anything with that. None of the fixes suggested online seem to help the scenario.

Is there anything to do with the uninstall of the first version of the Android Studio?

There is absolutely no change in the code of my project. The same project is working perfectly on my teammates' Android Studio. Below is the error I am getting :

"No toolchains found in the NDK toolchains folder for ABI with prefix: mipsel-linux-android"

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.getBuildAnalysis(DefaultGradleLauncher.java:107) at org.gradle.launcher.exec.GradleBuildController.configure(GradleBuildController.java:79) at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:60) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:43) at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:40) 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.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40) at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:75) 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) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.RuntimeException: No toolchains found in the NDK toolchains folder for ABI with prefix: mipsel-linux-android at com.android.build.gradle.internal.ndk.DefaultNdkInfo.getDefaultToolchainVersion(DefaultNdkInfo.java:330) at com.android.build.gradle.internal.ndk.DefaultNdkInfo.getToolchainPath(DefaultNdkInfo.java:207) at com.android.build.gradle.internal.ndk.DefaultNdkInfo.getStripExecutable(DefaultNdkInfo.java:300) at com.android.build.gradle.internal.ndk.NdkHandler.getStripExecutable(NdkHandler.java:333) at com.android.build.gradle.internal.transforms.StripDebugSymbolTransform.(StripDebugSymbolTransform.java:73) at com.android.build.gradle.internal.TaskManager.createStripNativeLibraryTask(TaskManager.java:1339) at com.android.build.gradle.internal.ApplicationTaskManager.createTasksForVariantData(ApplicationTaskManager.java:289) at com.android.build.gradle.internal.VariantManager.createTasksForVariantData(VariantManager.java:485) at com.android.build.gradle.internal.VariantManager$3.call(VariantManager.java:293) at com.android.build.gradle.internal.VariantManager$3.call(VariantManager.java:290) at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156) at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120) at com.android.build.gradle.internal.profile.SpanRecorders.record(SpanRecorders.java:44) at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:286) at com.android.build.gradle.BasePlugin$11.call(BasePlugin.java:688) at com.android.build.gradle.BasePlugin$11.call(BasePlugin.java:685) at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156) at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120) at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:683) at com.android.build.gradle.BasePlugin$10.call(BasePlugin.java:608) at com.android.build.gradle.BasePlugin$10.call(BasePlugin.java:605) at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156) at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120) at com.android.build.gradle.BasePlugin.lambda$createTasks$1(BasePlugin.java:603) 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)

回答1:

According to https://github.com/android-ndk/ndk/wiki/Changelog-r18#known-issues

This version of the NDK is incompatible with the Android Gradle plugin version 3.0 or older. If you see an error like No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android, update your project file to use plugin version 3.1 or newer. You will also need to upgrade to Android Studio 3.1 or newer.

The workarounds are as below: (https://stackoverflow.com/a/51852529/8034839)

Option 1:

buildTypes {
    debug {
        externalNativeBuild {
            cmake {
                abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
            }
        }
    }
    release {
        externalNativeBuild {
            cmake {
                abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
            }
        }
    }
}

Option 2:

android {
    ...
    packagingOptions{
        doNotStrip '*/mips/*.so'
        doNotStrip '*/mips64/*.so'
    }
    ...
}


回答2:

Upgrade your Gradle Plugin

classpath 'com.android.tools.build:gradle:3.2.1'

or go to :

~/Library/Android/sdk/ndk-bundle

and download NDK 17 https://developer.android.com/ndk/downloads/older_releases

change NDK in /android/sdk/ndk-bundle with new NDK 17

and change the classpath to :

classpath 'com.android.tools.build:gradle:2.2.2'

Happy Coding :)