How to fix Manifest merger failed - android

I imported GoogleMapsV2WithActionBarSherlock eclipse project and encountered
Error:Execution failed for task ':googleMapsV2:processDebugManifest'.
Manifest merger failed : Attribute meta-data#com.google.android.gms.version#value value=() from
[GoogleMapsV2WithActionBarSherlock:androidmapsutils:unspecified]
AndroidManifest.xml:8:13-29 is also present at
[com.google.android.gms:play-services-basement:11.0.2]
AndroidManifest.xml:20:66-119
value=(#integer/google_play_services_version). Suggestion: add
'tools:replace="android:value"' to element at
AndroidManifest.xml:6:9-8:32 to override.
Is anybody has a clue on what it is and how can I fix it?
Here are the list of the errors.
googleMapsV2 build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.ecs.google.maps.v2.actionbarsherlock"
minSdkVersion 14
targetSdkVersion 17
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':androidmapsutils')
compile project(':library')
compile 'com.google.code.gson:gson:2.1'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:gridlayout-v7:18.0.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/commons-logging-1.1.1.jar')
compile files('libs/google-http-client-1.15.0-rc.jar')
compile files('libs/google-http-client-android-1.15.0-rc.jar')
compile files('libs/google-http-client-jackson2-1.15.0-rc.jar')
compile files('libs/httpclient-4.0.1.jar')
compile files('libs/httpcore-4.0.1.jar')
compile files('libs/jackson-core-2.1.3.jar')
compile files('libs/jackson-core-asl-1.9.11.jar')
}
androidmaputils build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.0'
compile 'com.google.android.gms:play-services-maps:11.0.2'
}
GoogleMapsV2WithActionBarSherlock build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
}
allprojects {
repositories {
jcenter()
}
}
PagerTabSlidingTabStrip build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 17
buildToolsVersion "26.0.0"
defaultConfig {
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
}

Check your build.gradle(app) minSdkVersion 14 and
compile 'com.google.android.gms:play-services-maps:11.0.2'

add tools:replace="android:value" to your manifest to the end of <application> tag

Related

When I add CMake path in gradle, build process stuck with StackOverflowError

I'm trying to implement this approach - https://www.androidsecurity.info/2016/12/15/storing-your-secure-information-in-the-ndk/.
The moment when I add cmake path in a gradle file,
externalNativeBuild {
cmake {
path 'src/CMakeLists.txt'
}
}
building process stuck with StackOverflowError.
_
Note. If I implement that approach in a new project, everything works fine - gradle builds successfully, and native method works in java class. The problem occurs when I do the same on my "production" project with many dependencies.
As you can see gradle stuck on "resolve artifact uiautomator-v18.aar". When remove "uiautomator" from dependencies, same error appears but with "espresso-core", remove "espresso-core" - "hamcrest-library" is the next, and so on.
All module build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'kotlin-android-extensions'
androidExtensions {
experimental = true
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
repositories {
jcenter()
}
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'io.fabric.tools:gradle:1.21.4'
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
android {
lintOptions {
// google services plugin is causing missing translation issue
abortOnError false
disable 'MissingTranslation'
}
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.toolsVersion
signingConfigs { ... }
defaultConfig {
applicationId "..."
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
buildConfigField "boolean", "USE_ANALYTIC", "false"
buildConfigField 'boolean', 'USE_TRANSLATION', 'false'
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "USE_ANALYTIC", "true"
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
debuggable true
buildConfigField "boolean", "USE_ANALYTIC", "false"
}
}
productFlavors {...}
externalNativeBuild {
cmake {
path 'src/CMakeLists.txt'
}
}
dataBinding { enabled = true }
}
configurations { ... }
dependencies {
...
// debug tools
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile rootProject.deps.firebaseMessaging
compile rootProject.deps.firebaseCore
compile rootProject.deps.firebaseConfig
compile 'com.squareup.picasso:picasso:2.5.2'
compile('com.mcxiaoke.viewpagerindicator:library:2.4.1') {
exclude module: 'support-v4';
}
compile "com.android.support:support-vector-drawable:$supportLibrary"
compile "com.android.support:animated-vector-drawable:$supportLibrary"
compile rootProject.deps.appCompat
compile rootProject.deps.cardView
compile rootProject.deps.design
compile project(':sublimepickerlibrary')
compile project(':segmentedcontrol')
compile project(':stickyheaderlist')
compile "com.android.support:customtabs:$supportLibrary"
apt rootProject.deps.daggerCompiler
testCompile rootProject.testDeps.junit
testCompile rootProject.testDeps.intellijannotations
testCompile rootProject.testDeps.mockito
testCompile rootProject.testDeps.mockitoKotlin
androidTestCompile "com.android.support:support-annotations:$supportLibrary"
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.artemzin.rxjava:proguard-rules:1.0.14.2'
compile rootProject.deps.rxAndroid
compile rootProject.deps.rxJava
}
configurations.all {
resolutionStrategy {
force "org.mockito:mockito-core:$mockito",
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
apply plugin: 'com.google.gms.google-services'
Appreciate any help - either direct answer or at least point out where to research.

Compiling Android Project

What is wrong? I can't compile project and get error:
Error:Execution failed for task ':app:transformClassesWithDexForGoogleDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --force-jumbo --num-threads=4 --multi-dex --main-dex-list C:\Users\andre\Desktop\MYproject\app\build\intermediates\multi-dex\google\debug\maindexlist.txt --output C:\Users\andre\Desktop\MYproject\app\build\intermediates\transforms\dex\google\debug\folders\1000\1f\main C:\Users\andre\Desktop\MYproject\app\build\intermediates\transforms\jarMerging\google\debug\jars\1\1f\combined.jar}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "com.gvarani.myproject"
minSdkVersion 17
targetSdkVersion 26
versionCode 15
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //important
}
useLibrary 'org.apache.http.legacy'
signingConfigs {
release
}
buildTypes {
debug {
minifyEnabled false
shrinkResources false
}
release {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard/proguard-project.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
flavorDimensions "release"
productFlavors {
google {
dimension "release"
}
other {
dimension "release"
}
}
dexOptions {
javaMaxHeapSize "2g"
jumboMode true
}
}
ext {
supportLibVersion = '26.0.0'
gmsVersion = '11.0.4'
}
dependencies {
googleCompile "com.google.firebase:firebase-crash:${gmsVersion}"
googleCompile "com.google.firebase:firebase-messaging:${gmsVersion}"
googleCompile "com.google.firebase:firebase-auth:${gmsVersion}"
googleCompile 'com.anjlab.android.iab.v3:library:1.0.42'
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:cardview-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:customtabs:${supportLibVersion}"
compile "com.google.firebase:firebase-perf:${gmsVersion}"
compile "com.google.firebase:firebase-database:${gmsVersion}"
compile "com.google.firebase:firebase-ads:${gmsVersion}"
compile 'com.firebaseui:firebase-ui-auth:2.2.0'
compile 'com.firebaseui:firebase-ui-database:2.2.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'dev.dworks.libs:volleyplus:0.1.4'
compile 'cat.ereza:customactivityoncrash:2.1.0'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
compile 'org.fabiomsr:moneytextview:1.1.0'
compile 'com.zsoltsafrany:needle:1.0.0'
compile 'com.github.lykmapipo:local-burst:v0.2.0'
compile 'com.github.javiersantos:AppUpdater:2.6.1'
compile 'de.psdev.licensesdialog:licensesdialog:1.8.2'
compile 'org.jsoup:jsoup:1.10.3'
compile 'com.wordplat:ikvStockChart:0.1.5'
compile 'com.android.support:multidex:1.0.0'
//Kotlin dependencies
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services
Please try below code
android{
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
//...
compile 'com.android.support:multidex:1.0.0'
}
**Hope this will help **
Put below line in build.gradle;
multiDexEnabled true
like this:
defaultConfig
{
applicationId "yourProjectPackage"
minSdkVersion 15
versionCode 1
versionName "1.0"
targetSdkVersion 23
multiDexEnabled true //important
}
add follow code in your manifest.xml file:
<application
android:name="android.support.multidex.MultiDexApplication">
</application>
Add below lines to your app build.gradle
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Add maven { url "https://maven.google.com" } in Project level gradle
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}

how does the gradle dependencies work, i can not find any function relate with it in the gradle source code

how does the gradle dependencies work, i can not find any function relate with it in the gradle source code.
please help me , I googled this but found nothing...
dependencies {
}
gradle dependencies work from build.gradle(Module:app)
buildscript {
repositories {
....
}
dependencies {
...........
}
}
apply plugin: 'com.android.application'
apply plugin: '..'
repositories {
.....
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "your pkg name"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
//Here you can add your dependencies
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
........
}

Robospock and gradle build variants?

I'm using Robospock to perform unit testing and mocking with gradle. This worked great until I added gradle build variants to the mix.
My android build.gradle file:
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName "0.0.1"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
uat {
packageName "com.acme.dev"
}
stage {
packageName "com.acme.staging"
}
prod {
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.mcxiaoke.volley:library:1.0.4'
}
My robospock build.gradle file:
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
classpath 'org.robospock:robospock-plugin:0.4.0'
}
}
repositories {
mavenCentral()
}
apply plugin: 'groovy'
dependencies {
compile "org.codehaus.groovy:groovy-all:1.8.6"
compile 'org.robospock:robospock:0.4.4'
compile 'cglib:cglib-nodep:2.2'
compile 'org.objenesis:objenesis:1.3'
}
project.ext {
robospock = ":Mothership" // project to test
}
apply plugin: 'robospock'
The Android gradle plug-in offers me build variant tasks such as assembleProd, assembleProdDebug, assembleStageDebugTest. Can I pass something to Robospocl in my build.gradle so that it can participate in the build variants?
Currently when I execute ./gradlew robospok, it cannot find the classes defined in com.acme.dev or com.acme.staging

Import remote library from Maven

I'm trying to add both Showcaseview by amlcurran and Android-DirectoryChooser by passy to my android app from MavenCentral, but I keep getting this error for both libraries:
Error:net.rdrei.android.dirchooser:library:2.0
This is my Project Gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
This is the inner one:
apply plugin: 'android'
android {
lintOptions {
checkReleaseBuilds false
}
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 6
versionName "1.2.2"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'org.jaudiotagger:jaudiotagger:2.0.1#jar'
compile 'com.android.support:support-v4:19.1.0'
compile 'net.rdrei.android.dirchooser:library:2.0#aar'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
How can I fix it?
The problem is that you are not specifying the repository URL. Check my answer here:
https://stackoverflow.com/a/23879736/570612

Categories

Resources