Android Studio API level error for Android Wear - android

I am trying to run and test a simple android application using android studio(version 3.0.1) on a smartwatch, I am getting the below error with respect to the gradle sync. (I am creating an new project by selecting the wear with the API level of 22 which is same as smartwatch API level).
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 22 cannot be smaller than version 23 declared in library [com.android.support:wear:26.1.0] C:\Users\Sai.gradle\caches\transforms-1\files-1.1\wear-26.1.0.aar\5b2a40104c2cc0843c9e44597771b49a\AndroidManifest.xml as the library might be using APIs not available in 22
Suggestion: use a compatible library with a minSdk of at most 22,
or increase this project's minSdk version to at least 23,
or use tools:overrideLibrary="android.support.wear" to force usage (may lead to runtime failures)
I have looked up for this error in most of the stackoverflow post's and they suggested to change the minimum SDK version in the build.GRADLE (app module) file in the defaultConfig section to 23, and the error doesn’t appear when I change the version to 23 as below.
defaultConfig {
applicationId "com.example.sai.wearexample"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
But, if I change the minSdkVersion version to 23 then there is the below error while I want to run the application on the smartwatch.
I have looked into many of the answers in the stackoverflow but I am not able to get any of the specific resolutions for this question. I am stuck in between these two errors, any help would be appreciated.

You should not use com.android.support:wear for api <23.
For the views you can add:
provided 'com.google.android.wearable:wearable:2.3.0'
compile 'com.google.android.support:wearable:2.3.0'
And change in your java and xml the code for use the tools of
com.google.android.wearable
instead
com.google.android.support:wearable
For example, use android.support.wearable.view.BoxInsetLayout instead of android.support.wear.widget.BoxInsetLayout.
I hope I have helped.

Related

How to reduce my minSdkVersion on my module?

I developed a networking module for my company. The initial defaultConfigs we set defined minSdk as 29 and it was with these settings that version 1.0.0 of this module was published. Now the need arose to reduce this value to 26 or even less, if possible. I already changed the minSdkVersion to 26 in the module and published a new version, but I always get the same error:
Manifest merger failed : uses-sdk:minSdkVersion 26 cannot be smaller than version 29 declared in library [nearsea-technologies:android.network:1.0.1] (...)/.gradle/caches/transforms-3/c729ae7e60a0cde9500d48b107ed3b46/transformed/android.network-1.0.1/AndroidManifest.xml as the library might be using APIs not available in 26
Suggestion: use a compatible library with a minSdk of at most 26,
or increase this project's minSdk version to at least 29,
or use tools:overrideLibrary="nst.android.network" to force usage (may lead to runtime failures)
This is the defaultConfig of my module and my current project is the same.
defaultConfig {
minSdk = 26
targetSdk = 33
(...)
}
How can I resolve this? What do I need to do? What am I missing?
If you need more code, I can make it available.
In AndroidManifext.xml for your module just add line:
<uses-sdk tools:overrideLibrary="nst.android.network" />

i got this error while i builde my project

Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller
than version 16 declared in library
[com.google.firebase:firebase-iid:20.0.2]
C:\Users\bushi.gradle\caches\transforms-2\files-2.1\946a39d7756c6b05aa38a853bdffc128\firebase-iid-20.0.2\AndroidManifest.xml
as the library might be using APIs not available in 15 Suggestion:
use a compatible library with a minSdk of at most 15, or increase
this project's minSdk version to at least 16, or use
tools:overrideLibrary="com.google.firebase.iid" to force usage (may
lead to runtime failures)
Change minSdkVersion 15 in your build.gradle file to minSdkVersion 16.
The libraries you are referencing require a later version of Android.
You can find the build.gradle file under Gradle Scripts in Android Studio. The change you want to make is in the (Module: app) build file.

Android support compat errors

My project worked fine last time.
Now I can't build this, I see a lot of problems in com.android.support/apcompat-v7/22.0.0/res/values-v21/values.xml
Error:(47, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
I need to build my application for minSdkVersion 16 and targetVersion 16.
My project is compiling only if I set minSdkVersion, targetVersion and compilingVersion to 21.
I'm using Android Studio 1.2.2.
Please help me to fix this problem.
I see a lot of problems in com.android.support/apcompat-v7/22.0.0/res/values-v21/values.xml
Your compileSdkVersion should be 22, if you are going to use a 22.x.y version of a support library.
I need to build my application for minSdkVersion 16 and targetVersion 16.
Set minSdkVersion to 16, targetSdkVersion to 16, and compileSdkVersion to 22. Changing minSdkVersion nor targetSdkVersion values will not result in errors like the one that you cite.
To fix this problem you need to use:
compileSdkVersion 21
I didn't known before about:
compileSdkVersion - is the version of the API the app is compiled against. This means you can use Android API features included in that version of the API.
minSdkVersion - controls the lowest level you say your application can run on.
targetSdkVersion - ontrols any automatically applied backward compatibility features

Trouble on android linux in Jenkins

meet face to face with trouble that :
java.lang.UnsupportedOperationException: Robolectric does not support API level 1, sorry!
properties in my build gradle :
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
What it can be?
versionCode in your code example is 1, the exception says API level 1 is not supported...I have the impression that "versionCode" represents the API level. What happens if you increase the versionCode - Value?
am not sure about your environment or tool setup, just make sure that your jenkins build is configued to build using gradle/gradle based build tool (only they will parse build.gradle file and generate a Manifest with proper fields) or if u r using some other build tool update the AndroidManifest with appropriate api level values

How to make a gradle android app compatible with above api version

I have an app that works fine on API 19. However, I want it to work well in other API's as well. I'm targeting API 10 and above.
My gradle build looks like this:
android {
compileSdkVersion 18
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 18
}
}
But when I run the app on API 10 the AVD manager says compatible: no
How should I change my build so that it is compatible for API 10 and above?
Your gradle config looks correct. Be sure to check your virtual device settings and compare to what you have defined in your manifest file. Also be sure to check any other modules you may have added to the project and their respective gradle and manifest files.

Categories

Resources