nikdange_me nikdange_me - 1 month ago 13
Android Question

Gradle build failed, appcompat-v7 issue

I am using easy-ocr-library and wifi-direct-demo library, i have just modified wifi-direct-demo as per my requirement.

I am trying to add easy-ocr-library into wifi-direct-demo library app,
so i added easy-ocr-library as new module in wifi-direct-demo library.

After adding "easy-ocr-library" as module dependency in "wifi-direct-demo" , i got

Error:Execution failed for task ':processDebugManifest'.


Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library [wifi-direct-demo-m4:easy_ocr_library:unspecified] /Users/nikhildange/Desktop/wifi-direct-demo-m2/build/intermediates/exploded-aar/wifi-direct-demo-m4/easy_ocr_library/unspecified/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.wordpress.priyankvex.easyocrscanner" to force usage


So as suggested in Error i added in AndroidManifest.xml file of wifi-direct-demo-m2

<uses-sdk android:minSdkVersion="14" tools:overrideLibrary="com.wordpress.priyankvex.easyocrscanner"/>


After clicking 'Make Project', i am getting below error

/Users/nikhildange/Desktop/wifi-direct-demo-m4/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/res/values-v17/values-v17.xml

Error:(6, 21) No resource found that matches the given name: attr 'android:textAlignment'.

Error:(10, 21) No resource found that matches the given name: attr 'android:paddingEnd'.

Error:(10, 21) No resource found that matches the given name: attr 'android:paddingEnd'.

Error:(13, 21) No resource found that matches the given name: attr 'android:paddingStart'.

Error:(17, 21) No resource found that matches the given name: attr 'android:layout_marginEnd'.

.

.

.

/Users/nikhildange/Desktop/wifi-direct-demo-m4/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/res/values-v21/values-v21.xml

Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.

Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.

Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.

.


.

.

Error:Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/nikhildange/Library/Android/sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1


I am adding gradle file of all 3 modules,

easy_ocr_library/build.gradle

apply plugin: 'com.android.library'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
minSdkVersion 15
targetSdkVersion 22
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:22.2.1'
compile project(':tess-two')
}


tess-two/build.gradle

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
minSdkVersion 8
targetSdkVersion 22
}

sourceSets.main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
jniLibs.srcDirs = ['libs']
}
}


wifi-direct-demo-m4/build.gradle

apply plugin: 'com.android.application'

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}

allprojects {
repositories {
mavenCentral()
}
}

dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile project(':easy_ocr_library')
}

android {
compileSdkVersion 16
buildToolsVersion "23.0.2"

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}

// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')

// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}


After changing an minsdkverson to 15 in AndroidManifest.xml file of wifi-direct-demo-m2

<uses-sdk android:minSdkVersion="15"/>


i am getting the same error with below screen shot

Screenshot project after synch

Answer

The error says: uses-sdk:minSdkVersion 14 cannot be smaller than version 15

So:

<uses-sdk android:minSdkVersion="14" tools:overrideLibrary="com.wordpress.priyankvex.easyocrscanner"/>

must be at least

<uses-sdk android:minSdkVersion="15" />

Try to use sdk 15. And remove tools:overrideLibrary.