Android studio shows possible causes:
The project may be using a version of Gradle that does not contain the method.The build file may be missing a Gradle plugin.
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 17
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.android.application"
manifestPlaceholders = [manifestApplicationId: "${com.android.application}",
onesignal_app_id:"3z281386-18df-4ae8-95fb-da47db595f27",
onesignal_google_project_number:"570040958475"]
minSdkVersion 22
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.onesignal:OneSignal:2.+#aar'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-location:8.1.0' }
You need to add
apply plugin: 'com.android.application'
As the first line of the build.gradle
Related
Can't compile it and can't see in my library.
Error
gradle failed resolve `com.theartofdev.edmodo:android-image-cropper:+” Compilation fails.
build.gradle code
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.backuppc.breathanalyzer"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
The dependencies
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.theartofdev.edmodo:android-image-cropper:+'
}
Please replace the
compile 'com.theartofdev.edmodo:android-image-cropper:+'
with the latest version
compile 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
Please make sure the dependency is of latest version. You can get the latest version here:
https://bintray.com/package/files/arthurhub/maven/Android-Image-Cropper?order=asc&sort=name&basePath=com%2Ftheartofdev%2Fedmodo%2Fandroid-image-cropper&tab=files
Hope this helps..
https://android-arsenal.com/details/1/4136
not able to integrate this library
Stuck with this error - java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/os/BuildCompat;
here's my gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "matrixdev.com.waitel"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.cepheuen.elegant-number-button:lib:1.0.2'
compile('com.android.support:support-v4:23.3.0') {
force = true;
}
}
Have you tried removing the parenthesis for the last compile? like so:
compile 'com.android.support:support-v4:23.3.0'
instead of:
compile('com.android.support:support-v4:23.3.0')
I'm trying to sync project with Gradle. But gradle gives some error.
The error code like this : Error:A problem occurred configuring project ':app'.
Could not find support-annotations.jar (com.android.support:support-annotations:24.0.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-annotations/24.0.0/support-annotations-24.0.0.jar
My build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
repositories {
mavenCentral()
}
defaultConfig {
applicationId "com.example.ileem.tiiu"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0-alpha2'
compile 'com.android.support:design:24.0.0-alpha2'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.google.firebase:firebase-messaging:9.6.1'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile files('libs/gson-2.2.4.jar')
compile files('libs/jsoup-1.10.1.jar')
}
apply plugin: 'com.google.gms.google-services'
Try upgrading to the latest version of the build tools and support libraries. You can find them here.
The problem I am facing is that my android application works well on devices 4.4.2 and below, but crashes on devices having Lollipop(5.0) and its corresponding higher versions.I know that its somehow related to the build tools in my gradle file,but still not able to figure out the problem.Could someone please help me out with this.
This is my gradle file,
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.vs.vertosys"
minSdkVersion 14
targetSdkVersion 23
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter() {}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:multidex:1.0.1'
// compile 'com.android.support:appcompat-v4:23.1.1'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-location:+'
compile 'com.pushwoosh:pushwoosh:+'
}
I have a library project which had colliding xml names like activity_login,etc..
Now even though this is the case when I run the Actvity in the library project is inflating my xml instead of its own and subsequently throwing NPE.
I've already tried giving it the fully qualified R file name but it still seems to be inflating the wrong file.
Ps:I've tried clean build doesnt work either on AS1.2.1.1.
Is this a bug of AS or am I doing something wrong
Here is my gradle file
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.xxx"
minSdkVersion 14
targetSdkVersion 21
versionCode 17
versionName "2.4.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.android.support:support-v4:21.0.+'
compile 'com.android.support:recyclerview-v7:22.0.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile project('libraries:holograph')
compile project('libraries:facebook')
compile files('libs/google-api-client-android-1.18.0-rc.jar')
compile files('libs/google-api-client-java6-1.18.0-rc.jar')
compile files('libs/google-api-client-1.18.0-rc.jar')
compile 'com.crashlytics.android:crashlytics:1.+'
compile project(':chartlib')
compile project(':payu')
}
And build.gradle of payu is
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 2
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile('de.keyboardsurfer.android.widget:crouton:1.8.+#aar') {
exclude module: 'support-v7'
compile 'com.android.support:appcompat-v7:18.0.+'
}
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'de.greenrobot:eventbus:2.2.1'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.mobsandgeeks:android-saripaar:1.0.3'
compile project(':CustomBrowser')
}
And my Settings.gradle
include ':app', ':payUMoneysdk', ':CustomBrowser'
This is happening by design, consider it as overriding the library activity layout. I use it extensively for Strings, Colors etc. where it's more useful.
Just rename your projects XML layouts.