i can't run the app on android atudio - android-studio

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

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.

uses-sdk:minSdkVersion 19 cannot be smaller than version 22 declared in library

Earlier we were using Android API level 28 with minSdkVersion as 19 in config.xml and the app was available in the play store. Recently we updated the android version ( By removing and adding latest android as google play console mandated to have android above API level 29 ). Bu doing this ionic build gave below error :
Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 22 declared in library [:CordovaLib] D:\MobileApp\MyApp\platforms\android\CordovaLib\build\intermediates\library_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 19
Suggestion: use a compatible library with a minSdk of at most 19,
or increase this project's minSdk version to at least 22,
or use tools:overrideLibrary="org.apache.cordova" to force usage (may lead to runtime failures)
Due to this app could be updated in could of mobile phones. Please suggest if there is any way to have 19 as minSdkVersion.
Thanks !
Try to change the minSDKVersion to 22 in your config.xml file. I think the problem will be resolved. I had the same problem.
Example: <preference name="android-minSdkVersion" value="22" />
I have solution, it's not very complicated :
Enter on "player settings" (file --> build settings --> player settings) and scroll.
When you see "Minimum API Level", chante that (i choice Android 8.0 "Oreo" (API Level 26)).
Try adding this 1 line code below, under Gradle Scripts > gradle.properties (Project Properties) > Syn now > Build (Clean project > Rebuild project)
android.suppressUnsupportedCompileSdk=32

Glass Development Kit installed but not found by Android Studio

I get a Gradle Sync error saying "Failed to set up SDK": Error: Module 'app': platform 'Google Inc.:Glass Development Kit Preview:19' not found.
I have Glass Development Kit Preview from Android API 19 installed. My build.gradle(Module: app) is updated to reflect that:
compileSdkVersion 'Google Inc.:Glass Development Kit Preview:19'
buildToolsVersion '25.0.0'
I've looked at similar problems and I seem to have my build.gradle set up properly. How can I get the Gradle Sync to recognize my GDK?
You can try using the base build Tools for GDK:
android {
compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
buildToolsVersion "19.1.0"
}
Download Android 4.4.2 or API 19.
Or try using this link . It creates a new project of GDK, and you can check how gradle looks afterwards.

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.

Error: Please select Android SDK in Android Studio 2.0

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.

Resources