Android build fails with "NoSuchFieldError: FNAAPT2"

android

#1

Hello everyone, I’m encountering a failed build out of the blue, Failing build when trying to execute the following line :
if [ -f $ANDROID_HOME/tools/bin/sdkmanager ]; then $ANDROID_HOME/tools/bin/sdkmanager --update; fi
Picked up _JAVA_OPTIONS: -Xms512m -Xmx1024m

The error is as follows:
Exception in thread “main” java.lang.NoSuchFieldError: FN_AAPT2

Full Stack trace:
Exception in thread “main” java.lang.NoSuchFieldError: FN_AAPT2
at com.android.sdklib.BuildToolInfo.(BuildToolInfo.java:352)
at com.android.sdklib.BuildToolInfo.fromStandardDirectoryLayout(BuildToolInfo.java:224)
at com.android.sdklib.repository.legacy.local.LocalSdk.scanBuildTools(LocalSdk.java:898)
at com.android.sdklib.repository.legacy.local.LocalSdk.getPkgsInfos(LocalSdk.java:544)
at com.android.sdklib.repository.legacy.LegacyLocalRepoLoader.parseLegacyLocalPackage(LegacyLocalRepoLoader.java:100)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.parsePackages(LocalRepoLoaderImpl.java:167)
at com.android.repository.impl.manager.LocalRepoLoaderImpl.getPackages(LocalRepoLoaderImpl.java:124)
at com.android.repository.impl.manager.RepoManagerImpl$LoadTask.run(RepoManagerImpl.java:517)
at com.android.repository.api.RepoManager$DummyProgressRunner.runSyncWithProgress(RepoManager.java:397)
at com.android.repository.impl.manager.RepoManagerImpl.load(RepoManagerImpl.java:364)
at com.android.repository.api.RepoManager.loadSynchronously(RepoManager.java:290)
at com.android.sdklib.repository.AndroidSdkHandler$RepoConfig.createRepoManager(AndroidSdkHandler.java:718)
at com.android.sdklib.repository.AndroidSdkHandler.getSdkManager(AndroidSdkHandler.java:295)
at com.android.sdklib.tool.SdkManagerCli.(SdkManagerCli.java:134)
at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:118)
at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:93)

Not sure whats going wrong, can someone please assists me with this.
Thanks in Advance
-tejas

UPDATE :
Rebuild without cache options in the Dashboard fixes the issue, but the following build with cache fails again.


#2