Gradle DSL method not found when updating application version - gradle

I want to update my app on google play store, it can't accept the updated file with the same version.
Do I've changed the version from build.gradle file :
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "net.koorasudan.app"
minSdkVersion 14
targetSdkVersion 21
versionCode 5.1
versionName "5.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
But when I sync the gradle it shows me this error :
Error:(23, 0) Gradle DSL method not found: 'versionCode()'
Possible causes:The project 'SmartView 3' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
How to solve this problem?

The versionCode is an integer.
You can't use versionCode 5.1 in your build.gradle
Also you have to add this line at the beginning of your script.
apply plugin: 'com.android.application'

Did you add the android plugin on top of the gradle file?
apply plugin: 'android'
Version code needs to be an integer by the way! switch from 5.1 to 5 and it will work!

FWIW: I have encountered this problem when testing for large version codes (>= 10 digits). Gradle bug?

You should put your version code as Integer. after any publication of your app you have to increase version code so that the android OS finds out that this version is newer one.
but in Version name you can put what ever you want in string format.
hope usefull

Version code should be in integer format.
Please use the code below:
<i>
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "net.koorasudan.app"
minSdkVersion 14
targetSdkVersion 21
versionCode 5
versionName "5.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
</i>

just use version code 2, do not use version code 2.0 or any float value
versionCode 2
versionName "2.0"
like this and rebuild the app, it will solve your problem

Related

All com.android.support libraries must use the exact same version specification even after versions are same

This is all my gradle code
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.1'
defaultConfig {
applicationId "com.example.remindme"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:28.+'
compile 'com.android.support:recyclerview-v7:28.+'
compile 'com.getbase:floatingactionbutton:1.9.0'
compile 'com.wdullaer:materialdatetimepicker:1.2.1'
compile 'com.bignerdranch.android:recyclerview-multiselect:+'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
}
but it still is giving me error on this line
compile 'com.android.support:appcompat-v7:28.+'
I dont know whats wrong now any tips how to solve the issue now
You are using SDK version of 28 and please build your SDK version from 28.
Steps:
Close the current project.
Click on "Looking for updates".
Start update.
After the completion of your updates, go to setting and set your gradle offline and keep remember that your gradle should also be updated.
Thank you and I hope that will be helpful to you.

Android things connected with eth0 and Wlan0 but fail to install apk

I am trying to install apk first time on Raspberry Pi 3 board which have installed flashed .zip downloaded from android things console with empty bundle.
Now i am able to connect my device using wifi IP address assign to board .
So i connect it like :
adb connect 10.xxx.x.xxx:5555
connected to 10.xxx.x.xxx:5555
Now i am trying to install apk:
adb install D:\Project\xxx\xxx\app\build\outputs\
things_V01.apk
Failed to install D:\Project\xxx\xxx\app\build\outputs\
things_V01.apk
What could be issue here.
Below is my gradle of app .
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "xx.xxxx.xxxx"
minSdkVersion 14
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.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
provided 'com.google.android.things:androidthings:0.4.1-devpreview'
testCompile 'junit:junit:4.12'
}
Also noted that after adb install command it take much time for apk size withing 1.50MB apk .
As a sanity check, have you tried to interact with the device using another adb command such as **adb **?

Tango sample apps on Android Studio, with Gradle

Does anyone know a way to import the Java Tango samples (https://github.com/googlesamples/tango-examples-java) in Android Studio, and configuring correctly the build with Gradle ?
I've been able to import them in Android Studio, via "Import Project...", compile them and install them on the Tango tablet, but without using Gradle.
Any ideas ?
There is a git project which already migrates the samples to Android Studio - https://github.com/briangriffey/tango-examples-java
I think what you are asking for is the correct setup to let Gradle work for you.
For this you need to create a build.gradle file in your app's directory if the import did not do it for you. The build.gradle should look like this:
apply plugin: 'com.android.project'
android {
compileSdkVersion 16
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 17
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile files('libs/MyJar.jar')
}
With the corresponding values for SdkVersion, buildToolsVersion, minSdkVersion and targetSdkVersion.
In the "dependencies" block you can list all your jar-dependencies with :
compile files('libs/thejar.jar') or compile fileTree(dir: 'libs', include: ['*.jar']) if you have multiple jars.
Secondly, if it was not automatically created, you would need two files settings.gradle and build.gradle a the top-level of your project.
settings.gradle should contain:
include ':app'
assuming your app name is 'app'.
and build.gradle should contain:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Once you have this all in your project, you can use Build>Rebuild Project to make Gradle build the project for you.
Just as a follow up here, Tango c examples has been migrated to Android Studio project, you should be able to import directly to Android Studio now.

Error: more than one library with package name 'com.google.android.gms'

I'm using Android Studio 0.8.2, and created a project with Android 4.1 and Android Wear 4.4. I need to integrate it with Google Play Services.
I'm trying to follow the Google Play Services setup page for Android Studio here:
https://developer.android.com/google/play-services/setup.html
In Step 2, it says to add this dependency:
compile 'com.google.android.gms:play-services:5.0.77'
However, upon Sync, I get this message:
Error:Execution failed for task ':mobile:processDebugResources'.
> Error: more than one library with package name 'com.google.android.gms'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0
Here is my complete build.gradle file inside the mobile module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.OptimizedPrime.locationweartabs"
minSdkVersion 16
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.google.android.gms:play-services-wearable:+'
compile 'com.google.android.gms:play-services:5.0.77'
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v13:19.+'
}
It appears that the recommended dependency is conflicting with the wearable compile statement. I do want to retain wearable support, and at the same time need Google Play Services. How do I fix this?
If you have:
compile 'com.google.android.gms:play-services-wearable:5.0.77'
then you don't need:
compile 'com.google.android.gms:play-services:5.0.77'
Delete the non-wearable one.
May be possibly your are using have different types of dependencies with different versions:
com.google.android.gms:play-services-neededDependency:version
Ex: If you are using both dependencies as mention below:
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-ads:8.3.0'
Try to use same version for different dependencies Like:
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-ads:7.8.0'
Thank you, hope helpful to you.

Gradle deprecation "Relying on packaging to define the extension of the main artifact..." in Android Studio project can be fixed?

I'd like to learn how to use Android Studio at the best, but I still have limited experience especially in building with Gradle.
Executing tasks: [clean]
Relying on packaging to define the extension of the main artifact has
been deprecated and is scheduled to be removed in Gradle 2.0
:app:clean UP-TO-DATE
BUILD SUCCESSFUL
Even if everything works I would like to avoid using deprecated methods;
I state that I see this question and tried to understand the deprecation message but fairly the focus for me now is understanding building APK on Android Studio and how to put hands in a project created by this IDE.
Is it possible to fix-it by changing something (configuration files or artifacts) in the project?
PS: I'm on "Android Studio (preview) 0.4.3 build 133" and in the project there is two build.gradle:
1) ~/AndroidStudioProjects/MyAppProject/app/build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
2) ~/AndroidStudioProjects/MyAppProject/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
and one settings.gradle
~/AndroidStudioProjects/MyAppProject/settings.gradle
include ':app'
This appears to be a bug in the Android Gradle plugin and not something you're doing wrong; I see it coming up any time you include a dependency in one of your modules even if it's specified correctly. This warning isn't anything to worry about.
I've filed https://code.google.com/p/android/issues/detail?id=65501 about this.

Resources