Error creating new Android project with Android Studio - android

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

Related

Android - Error retrieving parent for item

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

Unable to add Gradle Dependency

I am trying to add this dependency to gradle, but I am receiving the below errors about other dependencies which I have not added in the first Place.
Errors :
Dependency I am trying to add is com.wdullaer:materialdatetimepicker:3.1.3
build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.pf.datetimepicker"
minSdkVersion 21
targetSdkVersion 24
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'])
compile 'com.android.support:appcompat-v7:+'
compile 'com.wdullaer:materialdatetimepicker:3.1.3'
}
which I have not added in the first Place.
Sure you did...
Look at the source of the library you got. https://github.com/wdullaer/MaterialDateTimePicker/blob/master/library/build.gradle
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:support-v13:25.2.0'
compile 'com.android.support:design:25.2.0'
First, you need compileSdkVersion 25 for those to even work, then you need to allow Android Studio to "Install Repository and Sync Project" or do it yourself by updating the SDK Manager.
Change your compile and targetsdk to 25
Change your compileSdkVersion, buildToolsVersion andtargetSdkVersion
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.pf.datetimepicker"
minSdkVersion 21
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'])
compile 'com.android.support:appcompat-v7:+'
compile 'com.wdullaer:materialdatetimepicker:3.1.3'
}
You have not installed the newest version of android support libraries. Just open SDK manager and install them. See the image

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

Failed to resolve: 'com.android.support:appcompat-v7:16.+'

I have a little problem with Android Studio:
Failed to resolve: 'com.android.support:appcompat-v7:16.+'
I also tried to install repository but appear another error.
apply plugin: 'com.android.application'
android {
compileSdkVersion 16
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "p11zt.futebol24"
minSdkVersion 16
targetSdkVersion 16
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:16.+' }
Change compile sdk to 23 try this
compileSdkVersion 23
targetSdkVersion 23
and use support:appcompat
compile 'com.android.support:appcompat-v7:23.0.0'

Categories

Resources