Android - Error retrieving parent for item - android

I am new to Android development. I have the default app which comes with Android studio which has a label on screen. When I try to run the app in an emulator, I get these errors:
I searched and then updated my sdk api to level 23. My gradle build is set to compile for 23 as well but I get this error and it won't run.

Your compile SDK version must match the support library's major version.
use compileSdkVersion 25
try this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "your_id"
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')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
}
EDIT
For Sdk 23
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "your_id"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
the idea is to use same version

Related

Error creating new Android project with Android Studio

I just created a new project Android with Android Studio and I have chosen the minimum SDK 9 (Gingerbread) and the activity NavigationDrawer Activity, once chosen and created the project I get the following error:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library [com.android.support:design:26.0.0-alpha1] C:\xxx\xxx\.android\build-cache\bd439271136a9bc6f4bc228104359605401bab70\output\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.design" to force usage
And I have not touched anything or modified anything that has created the Android Studio itself and I have updated the SDK with the latest versions.
Any suggestion?
Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "xx.xx.xx.seguros"
minSdkVersion 9
targetSdkVersion 26
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(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
What happening inside it is. The Library support design using the minimum SDK version 14. So you can't use this library if your app minimumSdk version lower than that.
You should use com.android.support:design:25.+ to support minSdkVersion 9.
If you use com.android.support:design:26.0.0-alpha1. You must use minSdkVersion 14
Update your gradle like this.
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "xx.xx.xx.seguros"
minSdkVersion 14 // Update it to 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Hope it helps:)
I have found two solutions to eliminate this error, but I don't know which one will be the most correct
I) Downloading the version, for this you have to modify the build.gradle using version 25 instead of 26 as follows:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "xx.xx.xx.seguros"
minSdkVersion 9
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(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.+'
compile 'com.android.support:design:25.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
II) Using tools: overrideLibrary, you have to modify the manifest by adding the following:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="es.uv.lisitt.seguros"
xmlns:tools="http://schemas.android.com/tools">
<uses-sdk tools:overrideLibrary="android.support.design, android.support.v7.appcompat,android.support.graphics.drawable, android.support.v7.recyclerview, android.support.v4, android.support.mediacompat, android.support.fragment, android.support.coreui, android.support.coreutils, android.support.compat"/>
.....
</manifest>
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0" //change
defaultConfig {
applicationId "xx.xx.xx.seguros"
minSdkVersion 14 //change
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
hope it helps

recycler view library versions compatible with compiled sdk version 24

I am having problems in adjusting my recycler view library version with the compiled SDK version as says error.
my code is as follows:-
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.users.recyclerviewreloaded"
minSdkVersion 14
targetSdkVersion 25
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:+'
compile 'com.android.support:recyclerview-v7:25.1.1'
}
Update Your compileSdkVersion and buildToolsVersion
compileSdkVersion 25 and buildToolsVersion "25.0.2"

Error in xml After Adding Google Map Activity

I am getting following error :
Error:(1) Error retrieving parent for item: No resource found that
matches the given name
'android:TextAppearance.Material.Widget.Button.Inverse'. in values
v-23.xml
Here is my gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.ashwin_bhoyar.techtt"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.google.android.gms:play-services:8.4.0'
}
No resource found that matches the given name
'android:TextAppearance.Material.Widget.Button.Inverse'
You should call API Level 23
compileSdkVersion 23
buildToolsVersion "23.1.0"
defaultConfig {
applicationId "com.example.ashwin_bhoyar.techtt"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
And use
compile 'com.android.support:appcompat-v7:23.1.0'
Please add this to your gradle.
compile 'com.android.support:appcompat-v7:23.1.0'
Hope this would work
I edited your gradle code ............try to this,I hope's its works
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.ashwin_bhoyar.techtt"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.1.2'
compile 'com.google.android.gms:play-services:8.4.0'
}
Your compile SDK version must match the support library's major version.
Since you are using version 23 of the support library, you need to compile against version 23 of the Android SDK.
Alternatively you can continue compiling against version 21 of the Android SDK by switching to the latest support library v21.
Please check The highlighted Part Of image

Downgrade Android SDK( api 23 -> api 21)

Due to some problems with permissions in SDK API 23 (Marshmallow) I wanted to switch back to API 21, yet I'm encountering some issues... I've read so many posts with similiar problems and tried (almost I guess) everything: I've updated all SDK Build/Platform Tools, features for API 21, Suport and Repository Libraries. Then I've cleaned up the project, rebuilt it and synchronized. Yet, I'm getting those errors:
My build.gradle looks like following:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.pablo.appcontacts"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.android.support:appcompat-v7:23.1.1'
}
I'm not very familiar with this, can anybody help me to fix this cause I really can't find a way to..?
3 Steps:
1 Edit build.grade
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.stackoverflow.answer"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
androidTestCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
2 Sync gradle button
3 Rebuild project

How to change the target version of android in android studio

I import an eclipse project into my android studio. The original project's target is android-14, but my studio's mimimum API version is 21. And I don't want to download the API 14, how should solve my problem?
You only must have downloaded the SDK configured as compileSdkVersion. Your SDK configured as minSdkVersion can be a lower version such as API 14.
In the Android Studio the configuration is realized in build.grade file. For example:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(":lib")
compile 'com.android.support:appcompat-v7:19.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
you have to add dependencies in build.gradle to use
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"

Categories

Resources