I am running into the zero supported device issue when publishing an Android application. I upload an APK, and Google Play tells me there is zero supported device.
My manifest is pretty simple, the only thing apart from the <application> section is this:
<uses-permission android:name="android.permission.INTERNET" />
I have no file in app/libs. I am using Android Studio.
The build.gradle file looks like this:
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.the.application"
minSdkVersion 15
targetSdkVersion 20
versionCode 902
versionName "0.9.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
production {
packageName "com.the.application"
}
test {
packageName "com.the.application.test"
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.zxing:core:3.0.0'
compile 'com.google.zxing:android-integration:3.1.0'
}
Any clue what could cause that?
Related
My Android App is good working on android 5 but when test app on other device(android 4) is crashing.
I did not use the special code.
Unfortunately my android studio is not have virtual device for api16 to see error log.
please help me.thanks
my gradle code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.blogsky.delete.azbook"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
}
We can not know what make ur app crash without error log. Please install sdk 16 and setup virtual device, and post your error message here
I created 2 flavors (com.example.admin.deb) and (com.example.admin.lab_127) And the difference between this two packages is in the MainActivity.java file (just two lines of code). In the build.gradle I created
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.admin.deb"
minSdkVersion 18
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors{
pro {
applicationId "com.example.admin.lab_127"
}
deb {
applicationId "com.example.admin.deb"
dependencies {
compile 'com.jakewharton:butterknife:5.1.2'
compile 'com.squareup.picasso:picasso:2.3.4'
compile 'org.lucasr.dspec:dspec:0.1.1'
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.+'
}
But when I change Build Variant nothing happens.My folder structure like this:
-app
----manifests
------------AndroidManifest.xml
----java
--------com.example.admin.deb
-----------MainActivity.java
--------com.example.admin.lab_127
-----------data
-----------ItemAdapter.java
-----------MainActivity.java
----res
So what I did wrong? Thanks in advance.
If you want to have a different version of the same class in the two flavor you'll need to create it in both flavors and do not put it in src/main/java. In your case:
src/deb/java/com/example/admin/deb/MainActivity.java
src/pro/java/com/example/admin/deb/MainActivity.java
You should implement next structure:
app
src
deb
java
com.example.admin.deb
MainActivity.java
main
java
com.example.admin.deb
res
pro
java
com.example.admin.deb
MainActivity.java
I'm building an application which needs a library with 2 variants - simulator & actual.
My objective is to create build tasks say assembleSimulatorDebug & assembleDebug.
assembleSimulatorDebug will include simulator module/library and assembleDebug will include actual module to build the apk.
I'm thinking of having if else blocks in dependencies sections of build.gradle. Can I have something like this?
I'm very new to gradle and trying from yesterday to set up something like this. It will be v helpful if anyone can provide some hints or links where I can get an idea to achieve this.
Update:
Found another solution. It's in another my answer.
It is possible by usage of 'Flavor products' of android gradle plugin. You can split library implementation by product flavor.
Initial requirements 'com.android.tools.build:gradle:1.0.0', Android Studio 1.0.1.
I created project at GitHub, so you'll be able to get it, run and learn.
You need to create two flavors of your app and library, too. For example, normal and simulator
Application's build.gradle
apply plugin: 'com.android.application'
android {
lintOptions {
abortOnError false
}
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.tivogi.gradle"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
normal {
}
simulator {
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
normalCompile project(path: ':library', configuration: 'normalRelease')
simulatorCompile project(path: ':library', configuration: 'simulatorRelease')
}
Library's build.gradle
apply plugin: 'com.android.library'
android {
publishNonDefault true
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
normal {
}
simulator {
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
Library:
split implementation between flavors by productFlavors (see my sample project if will have questions about that);
add publishNonDefault true into its build.gradle
From Gradle Plugin User Guide
It is also possible to publish all variants of a library. We are planning to allow this while using a normal project-to-project dependency (like shown above), but this is not possible right now due to limitations in Gradle (we are working toward fixing those as well).
Publishing of all variants are not enabled by default.
To enable them:
android {
publishNonDefault true
}
Application:
add normal and simulator product flavors (productFlavors);
add next lines to dependencies section
normalCompile project(path: ':library', configuration: 'normalRelease')
simulatorCompile project(path: ':library', configuration: 'simulatorRelease')
From Gradle Plugin User Guide
To create a dependency on another published artifact, you need to specify which one to use:
dependencies {
flavor1Compile project(path: ':lib1', configuration: 'flavor1Release')
flavor2Compile project(path: ':lib1', configuration: 'flavor2Release')
}
After all of that you'll be able to build 2 variants of applicaiton: normal and simulator.
Found solution for 2 libraries, it looks simpler. It's based on next from official guide
Finally, like Build Types, Product Flavors can have their own dependencies. For instance, if the flavors are used to generate a ads-based app and a paid app, one of the flavors could have a dependency on an Ads SDK, while the other does not.
dependencies {
flavor1Compile "..."
}
So you can create 2 individual libraries and create 2 flavors, for example, libraries are library-normal and library-simulator and flavors are normal and simulator.
Application build.gradle
apply plugin: 'com.android.application'
android {
lintOptions {
abortOnError false
}
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.tivogi.gradle"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
normal {
}
simulator {
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
normalCompile project(":library-normal")
simulatorCompile project(":library-simulator")
}
Application:
add only those lines into dependencies;
normalCompile project(":library-normal")
simulatorCompile project(":library-simulator")
Library:
does not require any change;
I published sample project of this solution at individual-libraries branch.
I am trying to test out an Android TV app on my TV. It works in the emulator and I am using Android Studio 0.8.14.
My build.gradle file is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "kgibilterra.com.tvgame"
minSdkVersion 21
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:leanback-v17:21.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.squareup.picasso:picasso:2.3.2'
}
I have everything installed in the SDK Manager and in AndroidManifest.xml I have
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21"/>
Has anyone else figured this out with AndroidTV specifically?
INSTALL_FAILED_OLDER_SDK you are facing means device you are trying to install your app on, is running lower version than required in your Manifest's android:minSdkVersion. I am almost sure your app is not requiring Lollipop to run, so you need to edit your Manifest and set these values correctly.
See docs: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
change the minSdkVersion value to 19. The issue will solved.
I recently imported my project from Eclipse to Android Studio and integrated Gradle's projectFlavors to support the different environment (DEV, QA and PROD). Although I encountered a problem with my in app billing. It seems to use the package name to query the google store but depending on my productFlavors the package name changes.
my gradle.build definition
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 10
targetSdkVersion 19
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
Prod {
packageName 'com.test.app'
}
Qa{
packageName 'com.test.app.qa'
versionName '1.2-QA'
}
Dev{
packageName 'com.test.app.dev'
versionName '1.2-DEV'
}
}
}
repositories{
mavenCentral()
mavenLocal()
}
dependencies {
compile 'com.test.android:infra:1.0#aar'
compile 'com.android.support:support-v4:+'
compile 'com.google.android.gms:play-services:4.3.23#aar'
compile files('libs/adgear-android-sdk.jar')
compile files('libs/crashlytics.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
compile project(':libraries:facebook')
}
Thanks for your time.
You gotta change the packageName property to applicationId.
productFlavors {
Prod {
applicationId 'com.test.app'
}
Qa{
applicationId 'com.test.app.qa'
versionName '1.2-QA'
}
Dev{
applicationId 'com.test.app.dev'
versionName '1.2-DEV'
}
}