Error: Please select Android SDK in Android Studio 2.0 - android-studio

I am using Android Studio 2.0 Beta2, and i am trying to run old project that uses google maps api v1 (package com.google.android.maps) as *.jar file. To run this old project i need specify compileSdkVersion older than the last one (23). I used
compileSdkVersion 'Google Inc.:Google APIs:17'
But i got Error: Please select Android SDK error in Android Studio. How i can run this old project with older compileSdkVersion?

Open gradle.buld in your app module
change versionCode or versionName and sync.

Also just sync the project from the tool bar

the easiest way is to:
Tools -> Android -> Sync Project with Gradle Files (Android Studio 3.0.1)

With Android Studio 2.1.3, I got this message when trying to launch my app.
I used the Module Settings dialog in AS to select another compile SDK version. Then I went back to the same dialog and chose Google API 17 again.
Then AS accepted the settings and could launch my app.
Really weird, as the contents of the build.gradle file is identical to what it was when I had the error message.

I could fix the problem in my case you need to set the compileSdkVersion and the buildToolsVersion manually in the android studio. I don't know why the android astudio doesn't recognize the value from gradle.
So the steps are:
File/Project Structure/Flavors/
and set the buildToolsVersion and compileSdkVersion.
But you need to check, because the android studio puts this value at the end of the gradle file and if you have replicated this variables, the gradle build make an error. So I make cut and paste in here
android {
defaultConfig {
compileSdkVersion 22
buildToolsVersion '22.0.0'
minSdkVersion 15
targetSdkVersion 22
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionDevel
versionName "${versionMajor}.${versionMinor}.${versionPatch}.${versionDevel}"
multiDexEnabled = true
}
and that's it!

It is works for me
intelliJ IDEA 13 error: please select Android SDK
My Problem: "please select Android SDK", But everything is okey :( -> I think one of IntelliJ file was crashed (after blue screen of death)
My resolution:
File -> Settings -> Android SDK -> Android SDK Location Edit -> Next, Next (Android SDK is up to date.), Finished
... and crashed file was repaired!
I hope this will help!

I just went to my Gradle button on the far right of the screen on the side and refreshed it and it worked for me.

Related

Unknown attribute warning in XML

AndroidManifest and XML layouts are showing me the Unknown attribute android: warning even though the attributes exist and the app works on the device.
Example: Unknown attribute android:maxSdkVersion, android:clickable="true" etc.
I am aware of the other questions regarding this issue and tried everything I could find about this topic but nothing works for me.
I tried to:
Sync Project with Gradle Files
Delete the .idea and .gradle folders from the project location
Delete caches from c:\Users\<user>\.gradle\caches\
Invalidate caches and restart ...and many other things I couldn't remember right now.
The problem still persists on a newly installed OS (Windows 11) and obviously, newly installed Android Studio, and also the issue affects only old projects...
Also, my project is up to date with everything the Android Studio doesn't show me any warning to update a version of a dependency or so.
Gradle version 7.3.3
Android Gradle Plugin Version 7.2.1
Update:
The warning appears only with the SDK version 33 (compileSdkVersion 33), if I build with version 32, the warning disappears...
Update2:
New projects which use API level 33 still show the warning...
Maybe it's a bug in the SDK?
UPD 20.01.2023: You can update Android Studio to the latest version now (Android Studio Electric Eel | 2022.1.1) and this bug is fixed there. Worked for me.
OLD: Got same crap and a lot of other.
And yes, just downgraded buildToolsVersion to "32.1.0 rc1" and targetSdkVersion, compileSdkVersion to API 32 for as long as bug exists in API 33.
Same here, I use this temporary workaround until Android team fix this issue or better solution.
Move all require code for Android 13 into library module (in my case, all of them are moved into utility module) and keep it use compile SDK 33
Temporary changes compile SDK in other module to 32 for local development
It's not ideal, but switching to Dolphin RC1 resolves this. Given that it will (presumably) hit stable pretty soon, it may not get fixed in Chipmunk. You can download Dolphin from the Android Studio Preview page, just be aware that it is not available as an installer so you will need to manually update your installed version or use it alongside until it hits stable.
Perfect!!
set compileSdkVersion to 32
compileSdkVersion 32
set targetSdkVersion to 32
targetSdkVersion 32
downgrade androidx.core:core-ktx
implementation 'androidx.core:core-ktx:1.8.0'
This config works for me:
Android Studio Dolphin | 2021.3.1
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
compileSdk 33 (SDK 33 Rev. 2, Sources 33 Rev. 1)
buildToolsVersion "33.0.0"
targetSdkVersion 33
Gradle Plugin version 7.3.0.

You cannot remove all production APKs and Android App Bundles

When I have used new version of google play console there is error showing, When I uploaded the appbundle or apk there are error message shows
I have tried looking for the solution on google but I don't find any solution relative to my problem.
When I clicked on Review release there are message showing (You cannot remove all production APKs and Android App Bundles)
I found that solution.
When I uploaded the .aab, I found that error too.
So I built the .apk and then I released it again. It was not showing an error and completed the release.
I think before your previous version is an .apk and now the uploaded file type is an .aab.
Is that right?
Increase the version name & code then upload it. I have already uploaded apk with same version name & code but with stagged rollout of 35 percent. When I was uploading aab file was getting the error. Resolved after increasing the increasing the version name & code value.
Kindly update compileSdkVersion and TargetSdkVersion to
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
}

Android Studio 3.0 Canary 2: attribute 'android:versionCode' not found

I've updated Android Studio to the latest canary build and now I can't run my app.
Every time when I try to build the project I get the following error:
Error:F:\...\**app_name**\app\build\intermediates\instant-run-support\debug\slice_0\AndroidManifest.xml:2 attribute 'android:versionCode' not found
I tried to manually open the file and the attribute is clearly there:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="****"
android:versionCode="1"
android:versionName="1.0"
split="lib_slice_0_apk">
</manifest>
I've tried to clean the project, invalidate cache, restart android studio but nothing helped.
This is my build.gradle (app) file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "****"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
}
This issue is strictly related to Instant Run. Workaround: disable it inside File -> Settings/Preferences. This will at least allow you to run your app in the Canary version of AS.
This bug is solved since Android Studio 3.0 Canary 6, just update android studio and all SDK components and restart Android Studio.
Tested on:
Build #AI-171.4163606, built on July 7, 2017
JRE: 1.8.0_152-release-884-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Simply invalidating the caches did the job for me.
File > Invalidate Caches & Restart
No need to disable Instant Run or manually delete any build folders.
What worked for me is a combination of what robin and SamboyCoding said.
Clean Project from build menu
Rebuild Project from build menu
Then I could launch the app for testing without problems.
What worked for me was going into my project folder, and deleting the "build" folder, to force gradle to recompile everything. I also deleted the "gradle" folder, but had to recreate it manually because AS didn't, but I don't think it was this that fixed it.
I had the same. I tried either rebuild the project or change build gradle a bit(e.g change a versionName) and sync, then mostly the issue is temporarily gone.
The fastest workaround that works for me in Android Studio 3.0 Canary 2 is to add the versionCode and versionName attributes, and when the error occurs, I just change it to any other value (e.g. 1.0 to 1.1 and back). Then the app starts fine.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.XXX"
android:versionCode="1"
android:versionName="1.0">
As for 6/9/2017 Android Studio 3.0 Canary 3 the bug still exists. After trying all mentioned ways to fix this, the one that works is to:
Clean Project
Build Project
Disable/Re-enable Instant Run feature
or
Reload Android Studio.
In case of the error - suggesting to send report to Google via Help > Report Instant Run Issue.., also create a bug report in Groups. Don't forget to link this StackOverlow page - may be this way Google will fix this annoying bug fast.
I got the same problem. So I tried the stable version 2.3.1 of android studio. Then there come a question if I want to use the Android studios SDK, I select this.
Try to run the app, a Gradle error come up, which request minimum Android Studio 3.0.
I start Android Studio 3.0 C2 again, the question regarding the SDK come up again, but then the app compiles and the versionCode error was gone.
Clean and rebuild the project
and restart android studio.
It will work.
After cleaning and rebulding I disabled instant run and re-enabled it and the error is gone.
Update Android studio to Canary 3. They solved the problem
Every time I get this following error:
Error:D:\StudioProjects\yoda\app\build\intermediates\instant-run-support\debug\slice_0\AndroidManifest.xml:2 attribute 'android:versionCode' not found
I'd like to delete D:\StudioProjects\yoda\app\build folder, then select Build\Rebuild Project, and everything will become all right.
For me it was enough to delete .gradle folder in the root folder of the project
open the manifest file & close it.
if still not working: rebuild, open manifest file & close it, -> RUN

i can't run the app on android atudio

Some help this error still appear even if I changed the minsdkversion and the compile
Error:Execution failed for task ':hoppingBird:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 9 declared in library [com.google.android.gms:play-services-ads:9.8.0] C:\Users\mohssin\Downloads\Documents\HoppingBird\hoppingBird\build\intermediates\exploded-aar\com.google.android.gms\play-services-ads\9.8.0\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms.ads.impl" to force usage
There are two places:
AndroidManifest.xml:
<uses-sdk android:minSdkVersion="9" ...
and build.gradle:
defaultConfig {
minSdkVersion 9
...
}
According to Google's Documentation
To test your app when using the Google Play services SDK, you must use either:
1. A compatible Android device that runs Android 2.3 or higher and includes Google Play Store.
2. The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.
So just change your minimum sdk version into 9 ( API Level: 9 -> Android 2.3 )
In AndroidManifest.xml
<uses-sdk android:minSdkVersion="9" />
In build.gradle:
defaultConfig {
minSdkVersion 9
}
and rebuild your project.
Here's the link to setting up Google Play Services

Sources for Android API 23 Platform not found (Android Studio 2.0)

Android Studio doesn't redirect me to API sources correctly. When I hit any function it decompiles .class file bytecode instead of accessing the right file from sdk/sources tree.
Hitting "download" and "refreshing" options does nothing. It's particularly annoying for implementing listeners since it generates functions' headers without variables' manes from documentation (i.e. var1, var2 etc.). I have installed API 23 (SDK platform, tools, docs, sources). I have set compile and target SDK to 23.
I tried to reinstall SDK tools, update AS from canary channel, invalidate cache but nothing helped so far.
I switched to API 21 and it works fine.
What am I missing?
My build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.myapp.app"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile project(':volley')
compile 'com.jakewharton:butterknife:7.0.1'
}
Below you can find gradle output for a blank project (without 3rd party libs) with the same API 23 set and the same behaviour.
Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:clean
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2330Library
:app:prepareComAndroidSupportAppcompatV72330Library
:app:prepareComAndroidSupportDesign2330Library
:app:prepareComAndroidSupportRecyclerviewV72330Library
:app:prepareComAndroidSupportSupportV42330Library
:app:prepareComAndroidSupportSupportVectorDrawable2330Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:mergeDebugAndroidTestShaders
:app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:mockableAndroidJar
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
BUILD SUCCESSFUL
Apparently this issue has been fixed in Android Studio 2.1.
Rerun the Android SDK Manager setup in Android Studio and this should solve your issue.
In Android Studio:
Windows: File -> Settings (ctrl+alt+s) -> Appearance & Behavior -> System Settings ->
Android SDK.
Mac: Android Studio -> Preferences (cmd + ,) -> Appearance & Behavior -> System Settings -> Android SDK.
Click on Edit on the right of the Android SDK location.
Click Next all the way through the wizard and this should fix the problem.
This was answered here for a different question.
For people facing the same problem, the solution is in this post for Linux and in the same topic here for Windows (thanks to Aamir Abro). Basically, you have to edit jdk.table.xml file for API level you are missing. I don't know why, but Android 2.0 and 2.1 RC don't have filled <root type="composite" /> in <sourcePath>. I updated sources' path <root type="simple" url="file://D:/android/sdk/sources/android-23" /> and now it works.
For Windows user file location: C:\Users{USER_NAME}.AndroidStudio2.0\config\options\jdk.table.xml
For Linux user file location: ~/Library/Preferences/AndroidStudioBeta/options/jdk.table.xml
Edit:
For some people resetting SDK location helped source.
As qbeck mentioned in his comment, resetting the path to the SDK fixed the issue for some of us.
Solution:
Android Studio 2.1 reporting in: solved the issue by resetting SDK.
Preferences -> Appearance & Behavior -> System Settings -> Android
SDK.
Click on Edit to the right of Android SDK location. Next, next, next
to complete the wizard and voila!
Encountered the same problem for API level 28 on Android Studio 3.2.1 on Windows 10. Refresh did not work.
Worked after restarting Android Studio.
to update your Android Studio to Api 23 go to :
Tools > Android > SDK Manager,
you can go then go to SDK Tools tab or click on Launch Sdandalone SDK Manager. check Android SDK Build-tools 23.0.2 to install
Update:
please, remove from your dependencies:
compile project(':volley')
and replace it with :
compile 'com.android.volley:volley:1.0.0'
There would be 2 errors sometimes, the first would say: 'platform android 28 not found', click next, 'accept some license agreement...'. Once you accept the agreement, both the errors will disappear.

Resources