I have two flavors: Customer and Driver. Both have different applicationIds(1. com.sample.Driver
2.com.sample.customer).
I can't install customer if Driver is installed and vice-versa.
I just cannot install both on the same device via Google Play. It works fine with apk install.
build.gradle:
productFlavors {
Customer {
applicationId "com.sample.customer"
minSdkVersion 16
targetSdkVersion 26
versionCode 21
versionName "3.6" }
Driver {
applicationId "com.sample.Driver"
minSdkVersion 15
targetSdkVersion 26
versionCode 20
versionName "3.6" } }
Main manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.sample">
Driver manifest:
<manifest xmlns:tools="http://schemas.android.com/tool"
xmlns:android="http://schemas.android.com/apk/res/android">
Related
Gradle2 4.2
My app/build.gradle:
android {
compileSdkVersion 26
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.myproject"
minSdkVersion 16
targetSdkVersion 23
versionCode 25
versionName "1.2.25"
}
}
My steps for deploy apk to Fabric (Beta by CrashLytics)
Manually increment versionCode and verionName. In this example: versionCode 26 and versionName "1.2.26"
Create distributive (apk) and deploy to CrashLytics by command:
gradlew assembleDebug crashlyticsUploadDistributionDebug
And as result my apk success deploy to Fabric with versionName = "1.2.26"
OK. It's work fine.
But I need to automatically increment versionCode and versionName BEFORE deploy to Fabric.
To do this I need to write custom Gradle task. Does my approach correct?
I created two programs with a signature and two different names.
First app:
defaultConfig {
applicationId "ir.bitafaraz.dpnadpnaadmin"
minSdkVersion 17
targetSdkVersion 25
versionCode 3
versionName "1.0"
}
Second app:
defaultConfig {
applicationId "ir.bitafaraz.dpnadpna"
minSdkVersion 17
targetSdkVersion 25
versionCode 3
versionName "1.0"
}
My phone is Samsung(A5 2017, android 6.0.1).
I can not install both of them together.
I also tried with two different signatures.
Very interesting, I use the following library in both projects:
com.commonsware.cwac: provider: 0.4.3
Based on the link below:
https://github.com/commonsguy/cw-omnibus/tree/master/ContentProvider/V4FileProvider
When I deleted this library, my problem was solved.
EDIT:
The value of the AUTHORITY field is the same in both programs, their values must be different.
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "me.drakeet.seashell"
minSdkVersion 14
targetSdkVersion 21
versionCode 80
versionName "2.2"
}
Above code is in my gradle.build, and my app run perfectly in Android Lollipop (5.0), so I am puzzled that why Play judge and limit it just support Android 4.0~4.4, why not 5.0+?
Thanks!
I have fix it.
just add:
maxSdkVersion 21
in the gradle.build nearby minSdkVersion.
I migrated an older Android app to Android-Studio/Gradle. The test need uiautomator-v18 which requires minSdkVersion=18. However, I would like to have the minSdkVersion set to 15 or 16.
There are many questions on SO over the same thing, but I am just not able to resolve this problem.
Exerpt AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.searcher"
android:versionCode="1"
android:versionName="0.0.1" >
<uses-sdk
tools:overrideLibrary="android.support.test.uiautomator.v18"/>
<!-- ... -->
</manifest>
The build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.searcher"
minSdkVersion 15
targetSdkVersion 23
testApplicationId "com.example.searcher.test"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile files('libs/dagger-1.2.1.jar')
compile files('libs/dagger-compiler-1.2.1.jar')
compile files('libs/javawriter-2.1.2.jar')
compile files('libs/javax.inject.jar')
androidTestCompile(
'com.android.support:support-annotations:23.2.0',
'com.android.support.test:runner:0.4.1',
'com.android.support.test:rules:0.4.1',
'com.android.support.test.uiautomator:uiautomator-v18:2.1.1',
'org.hamcrest:hamcrest-library:1.3',
'org.mockito:mockito-core:1.10.5',
'junit:junit:4.12',
'com.google.dexmaker:dexmaker:1.1',
'com.google.dexmaker:dexmaker-mockito:1.1'
)
}
The above gives the error:
Error:Execution failed for task ':app:processDebugAndroidTestManifest'.
> java.lang.RuntimeException: Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 18 declared in library [com.android.support.test.uiautomator:uiautomator-v18:2.1.1] /mypath/app/build/intermediates/exploded-aar/com.android.support.test.uiautomator/uiautomator-v18/2.1.1/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.test.uiautomator.v18" to force usage
But I am already using the overrideLibrary.
If this is not possible, is it possible to have different minSdkVersion for "main" and "androidTest"?
EDIT:
After adding the flavors, I was able to run the tests using build variant tstDebug. However, building it with prdDebug ends in an error saying that there are unknown stuff in the androidTest (example: package org.hamcrest does not exist). The modified excerpt of build.gradle:
defaultConfig {
applicationId "com.example.searcher"
targetSdkVersion 23
versionCode 6
versionName "0.5.0"
}
productFlavors {
prd {
minSdkVersion 15
}
tst {
minSdkVersion 18
testApplicationId "com.example.searcher.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
}
// And instead of "androidTestCompile" use "tstCompile"
Is it not possible to tell "Android Studio" that it should build the app without androidTest?
One option is to have a product flavor for your tests:
android {
productFlavors {
production {
minSdkVersion 15
}
uiTest {
minSdkVersion 18
}
}
...
}
And then run the tests on the uiTest flavor builds.
Did you put <uses-sdk tools:overrideLibrary ...> in src/main/AndroidManifest.xml?
If so, remove it from src/main/AndroidManifest.xml and try to put the following xml in src/androidTest/AndroidManifest.xml.
(Don't forget android:minSdkVersion="18")
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="YOUR PACKAGE NAME"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-sdk
android:minSdkVersion="18"
tools:overrideLibrary="android.support.test.uiautomator.v18"
/>
</manifest>
I do not find an answer. help!
I can not emulate my app that I get the error title .. all my information from the device and project is as follows:
Choose Device:
samsung GT-19300 Android 4.3(API 18) ---> No, minSdk(API 20) > deviceSdk(API 18)
build.gradle:
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "app.bluezone.win"
minSdkVersion 20
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
AndroidManifest.xml:
<uses-sdk android:minSdkVersion="20" android:targetSdkVersion="22"/>
What should I do?
Instead of changing the minSdkVerison & targetSdkVersion in build.gradle
Just open the Manifest file and use this
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21"/>
Ref : Android Studio : Failure [INSTALL_FAILED_OLDER_SDK]
Can you please try with below code
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "app.bluezone.win"
minSdkVersion 17
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
also remove sdk stuff from manifest file
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21"/>