I've added my SDK to Android Studio, but it doesn't appear in External Libraries, and gradle fails to sync.
Steps I followed:
Created my SDK in my AOSP build tree
In AS:
SDK Manager: I added my SDK as an SDK Update Site
SDK Platforms: Installed my SDK
Project Structure: Modules: Compile Sdk Version: I selected my SDK. This modifies my compileSdkVersion in my build.gradle file.
At this point, gradle attempts to sync and failed. The log shows:
com.android.tools.idea.gradle.project.sync.idea.issues.SdkPlatformNotFoundException: Module: 'mobile' platform 'MATT:MATT SDK Add-On LOCAL_BUILD:30' not found.
(mobile is the name of my module)
Thing is, everything appears correct. I see the SDK installed exactly where I would expect it in my SDK directory. As I mentioned above, the Project Structure dialog picks it up and writes it to the gradle file. I'm invalidated my cache, restarted, re-tried everything, everything I can think of. The name of the compileSdkVersion appears to be exactly what the XML dictates it should be (and it was all loaded by AS, I didn't manually type it)
I also do not see my SDK in the External Libraries tree in the Project's View
My AS version is
Android Studio Arctic Fox | 2020.3.1 Canary 14
Build #AI-203.7717.56.2031.7260174, built on April 5, 2021
Runtime version: 11.0.9.1+0-b77-7246554 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.8.0-44-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 28
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin
Current Desktop: i3
Though I had a co-worker who was previously able to set this up also run into this issue. I suspect there's some subtle step we're missing.
Other settings:
android {
compileSdkVersion 'MATT:MATT SDK Add-On LOCAL_BUILD:30'
buildToolsVersion '30.0.1'
// ...
}
I've played with other installed buildToolsVersion versions to no avail.
Related
Since a recent upgrade of Android Studio, I cannot build my project anymore. The surface error is:
e: C:\Users\<user>\dev\<project>\app\build\generated\source\navigation-args\release\com\<org>\<project>\ui\home\HomeFragmentDirections.kt: (3, 8): Unresolved reference: R
If I dig further and build from the terminal with gradlew (gradlew assembleDebug --debug):
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/mnt/c/Users/<user>/dev/<project>/local.properties'.
My local.properties file already contains this line:
sdk.dir=C\:\\Users\\<user>\\AppData\\Local\\Android\\Sdk
and that is where the SDK is installed.
In my build.gradle:
...
android {
compileSdkVersion 32
buildToolsVersion '32.1.0-rc1'
...
defaultConfig {
...
minSdkVersion 23
targetSdkVersion 32
...
}
settings.gradle:
include ':app'
rootProject.name = "<projectname>"
What I tried:
As per the error, I set the ANDROID_HOME environment variable to the
SDK location C:\Users\<user>\AppData\Local\Android\Sdk, and
restarting my machine to make sure the var is seen.
Clean project, rebuild project
File -> Invalidate caches
Install different versions of the SDK and SDK Tools
Reinstalling the SDK completely
Reinstalling Android Studio completely
I found innumerable posts with a problem similar to mine, and all seem to be solved by upgrading the SDK, changing compileSdkVersion/buildToolsVersion etc. in build.gradle, changing the SDK location in local.properties or the ANDROID_HOME environment variable. Or even reverting to an older SDK version. None of that works for me.
I'm out of options at this point. Any help/idea would be appreciated.
Current software:
Android Studio:
Android Studio Chipmunk | 2021.2.1
Build #AI-212.5712.43.2112.8512546, built on April 28, 2022
Runtime version: 11.0.12+7-b1504.28-7817840 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin (212-1.6.21-release-334-AS5457.46)
Android SDK: Android API 32 (Sv2)
Build-Tools installed: 32.1.0-rc1, 32.0.0, 30.0.3
ext.kotlin_version = "1.6.21"
Operating system: Windows 10
I have recently upgraded Android Studio to this version
Android Studio Arctic Fox | 2020.3.1 Patch 3
Build #AI-203.7717.56.2031.7784292, built on October 1, 2021
Runtime version: 11.0.10+0-b96-7281165 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 8192M
Cores: 12
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin
Since this upgrade, Android Studio constantly stops working correctly...
In as much as it stops code highlighting, code suggestions, compile errors, pretty much everything that makes it a useful IDE stops working.
The only actions I can take to repair this useless state is to either Close and reopen Android Studio or Invalidate Cache and restart Android Studio.
Is there any configuration settings I ned to change/set?
Is there anything I can do to resolve these issues?
This unexpected/unwanted behaviour is having an adverse effect on my teams productivity
Try to increase heap size.
Go to Preferences (Mac Os)/File (Windows) -> Appearence & Behaviour -> Memory Setting.
Check if multiDex is enabled in Gradle
android {
.....
defaultConfig {
............
multiDexEnabled true
}
}
This helped me when I got stuck with the same problem using Android Arctic Fox: I installed Android Bumblebee preview beta and problem disappeared.
Build: AI-192.6817.14.36.5994180, 201911071727,
AI-192.6817.14.36.5994180, JRE 1.8.0_212-release-1586-b04x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1920x1080, 1920x1080
AS: 3.6 Beta 4; Kotlin plugin: 1.3.50-release-Studio3.6-1; Android Gradle Plugin: 3.6.0-beta04; Gradle: 6.0.1; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
Check attached image. It appears Kotlin 1.3.6X is not installable from Android Studio.
With Reference to google issue tracker this has been fixed in latest version.
you can re-open or open new issue with reference to this https://issuetracker.google.com/u/1/issues/145468273 if you face the same.
Response from google
This happens after JetBrains releases a new Kotlin plugin version and
before Android Studio verifies it, usually a short time window. Should
not happen now since Android Studio has verified all existing Kotlin
stable versions.
In project settings (File -> Project Structure) 'Android NDK location' field is greyed out:
Clicking on 'Download Android NDK' briefly displays some dialog. There are several versions of NDK installed:
What is wrong with my setup?
Host: Ubuntu 18.04 LTS
Android Studio 4.1.1
Build #AI-201.8743.12.41.6953283, built on November 5, 2020
Runtime version: 1.8.0_242-release-1644-b3-6222593 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-128-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 2014M
Cores: 4
Registry: ide.new.welcome.screen.force=true, external.system.auto.import.disabled=true, debugger.watches.in.variables=false
Non-Bundled Plugins: com.intellij.ideolog, org.jetbrains.kotlin
Current Desktop: LXDE
Submitted bug report
Leave SDK Location ;) we can still select from Files> Project
Structure> Modules> NDK Version
Or, Simply Add
ndkVersion '22.0.7026061'
in build.gradle(app) like this
externalNativeBuild {
ndkBuild {
path file('src/main/jni/Android.mk')
}
}
ndkVersion '22.0.7026061' // your desire version
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
Extra Tips:--- you can set path variable here
Still App not Building for NDK ??
Close Android Studio.
Delete .temp folder located
C:\Users\%USERNAME%\AppData\Local\Android\Sdk (if exist)
Delete Options Folder located in
C:\Users\%USERNAME%\AppData\Roaming\Google\AndroidStudio4.1\
Delete NDK or ndk-bundle folder located in your SDK directory... in my case D:\Android\SDK\ndk
Now clean temps from SDK Manager > Optimize disk Space [don't worry it will not delete your essential files]
Now, install your desire NDK version from SDK Manager
I had this problem and by setting NDK value in local.properties file of my project, that problem gone
ndk.dir=D\:\\mySdkFolder\\sdk\\myNdkFolder
sdk.dir=D\:\\mySdkFolder\\sdk
With a project open, click Tools > SDK Manager.
Click the SDK Tools tab.
Select the NDK (Side by side) and CMake checkboxes.
I am facing an annoying bug in the newest Android Studio IDE (v4.0)
After the IDE restart(simple restart or after the PC restart, I can find any 100% case to reproduce this bug) sometimes AS starts and opens the project with such bugs:
Project structure becomes collapsed or hidden
Project files are NOT clickable in any case, so I can't close or open any files
Studio shortcuts do not work at all
The top toolbar is missing. (But still, it is shown as enabled in the "View" dropdown menu)
Some AS windows do not open. (For example, I am not able to open "Check For Updates" window)
I tried invalidating caches/restart option, but it makes no sense. The only solution is to delete AS studio(Without or with deleting of the settings), then install the older version of AS and make an update to the latest version of the AS.
If I try to simply delete AS and then install the latest 4.0 version, it will have the same bugs as were before the reinstall. If I want to install 4.0 studio without and older version-update routine, than I need to delete all the AS user settings.
What a hell is going on? Someone else facing this issue? Is there is a workaround for this annoying bug?
AS details:
Android Studio 4.0
Build #AI-193.6911.18.40.6514223, built on May 20, 2020
Runtime version: 1.8.0_242-release-1644-b01 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1237M
Cores: 16
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins: org.jetbrains.kotlin
delete C:\Users{username}.AndroidStudio4.0 folder then try to open the android studio you will re install all the configuration and file support for android studio