i am facing a strange issue. I have decided to enable databinding in my project and in order to do so i followed the developer.android guidelines. So i added the dataBinding tag in my gradle file and gradle sync fails and shows the following error.
Error:java.lang.NullPointerException
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.lang.NullPointerException
and no other information is there so that i can track down the problem. My gradle file is below:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId '***.********.***'
minSdkVersion 19
targetSdkVersion 26
versionCode 76
versionName '4.8.3'
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
// Enabling multidex support.
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
//todo useLibrary is added agains LinkedInActivity which uses legacy http connection,
//should change it to different implementation
useLibrary 'org.apache.http.legacy'
dexOptions {
jumboMode true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
packagingOptions {
exclude 'build.xml'
exclude 'lib/getLibs.ps1'
exclude 'lib/getLibs.sh'
exclude 'lib/gson-2.2.2.jar'
}
dataBinding {
enabled = true
}
lintOptions {
disable 'MissingTranslation'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':library_fab')
implementation project(':library')
implementation project(':barcodeScannerLib')
implementation project(':cropper')
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
}
compile
('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.10.6#aar') {
transitive = true
}
implementation project(':libraryDatePicker')
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.code.gson:gson:2.3.1'
compile 'de.greenrobot:greendao:1.3.7'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.8.0'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.android.support:palette-v7:26.0.1'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:exifinterface:26.0.1'
implementation project(':librarySweetAlertDialog')
}
apply plugin: 'com.google.gms.google-services'
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.4.0'
}
}
}
}
The problem with Databinding (and Dagger as well) is that, if there's an error, a lot of files are not generated, giving lots of errors. So much in fact, that the default output of javac is not enough to see the error message at the bottom.
Most of the time, it helps to increase the maximum number of error output lines, by adding this to your build.gradle
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "1500"
}
}
Related
Hello guys this is the error which I faced while I was running the app. I am fresher to android so I cant get the results.I already gone through some tech websites it suggested to change versions (compile SDK version and Build tools version ) yet I cant solve this. Can any one help me to solve this ?.
Error Message :
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Android Build.gradle file.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.24.4'
}
}
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'io.fabric'
android {
compileSdkVersion 25
buildToolsVersion "26.0.2"
repositories {
maven {
url 'https://maven.google.com'
}
maven { url 'https://maven.fabric.io/public' }
}
defaultConfig {
applicationId "com.smartgladiator.link"
minSdkVersion 21
targetSdkVersion 25
// Enabling multidex support.
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
versionCode 2
// versionName "1.0.37.1"
versionName "1.0.38"
}
dexOptions {
jumboMode true
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
zipAlignEnabled true
debuggable false
lintOptions {
disable 'MissingTranslation'
disable 'ResourceType'
}
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:customtabs:25.4.0'
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:support-v13:25.4.0'
//compile 'com.android.support:multidex:1.0.1'
//to make supported components
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'org.glassfish.tyrus.tests.servlet:tyrus-tests-servlet-autobahn-server:1.12'
compile 'org.glassfish.tyrus.tests:tyrus-tests-servlet-autobahn-server:1.0-b13'
compile 'com.github.nkzawa:socket.io-client:0.3.0'
compile 'com.baoyz.actionsheet:library:1.1.7'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.3'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile project(':speech')
// debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
}
Make sure android sdk localtion is set correctly
ANDROID_HOME = home/user/android_sdk/ "this is correct location"
ANDROID_HOME = home/user/android_sdk/tools "wrong path"
or
downgrade your gradle version
I know there are very similar questions asked previously but before I make any drastic changes I thought I would post the question here first.
This is the error I'm getting.
My build.gradle is like this
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.microsoft.graph.helpdesk"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
}
configurations {
all {
resolutionStrategy.force 'com.android.support:support-annotations:23.4.0'
}
}
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
dependencies {
// Azure AD
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.android.support:support-vector-drawable:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.github.baoyachi:StepView:1.9'
implementation 'com.github.vipulasri:timelineview:1.0.6'
compile(project(':o365-auth'))
// Dagger compiler for DI annotation support
annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.5'
provided('com.squareup.dagger:dagger-compiler:1.2.5')
// Butterknife
annotationProcessor 'com.jakewharton:butterknife:6.1.0'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.microsoft.graph:msgraph-sdk-android:1.1.0'
compile 'joda-time:joda-time:2.9.4'
compile 'com.google.guava:guava:19.0'
compile 'com.android.volley:volley:1.1.0-rc2'
compile 'com.android.support:design:27.0.2'
// Test libraries
androidTestCompile 'com.android.support:support-annotations:23.4.0'
//noinspection GradleCompatible
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2.2'
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
apply plugin: 'com.google.gms.google-services'
I have tried all the other solutions I could find but nothing has worked so far.
If anyone has any help at all it would be much appreciated
[EDIT] I have actually tried to run three other projects using API 27 and I am getting the same error.
at project ':o365-auth' that helped me to compile it;
try adal latest version or design instead appcompat etc
dependencies {
// compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
// Dependency injection
compile 'com.squareup.dagger:dagger:1.2.5'
provided 'com.squareup.dagger:dagger-compiler:1.2.5'
// Azure AD
compile 'com.microsoft.aad:adal:1.12.0'
}
compile(project(':o365-auth'))
have similar issues;
prev on 23 and 23.0.3 all work good
tried upper gradle but same issues on 25 too
I am facing an issue in Android studio
I have tried to update the recent build-tools version to 27.0.1 and SDK version to 28 but it throws the exception
Update:
I have mentioned the app level build.gradle file content below,
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '27.0.1'
dexOptions {
jumboMode true
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "XXXX.XXXX.XXXX"
minSdkVersion 17
targetSdkVersion 25
versionCode 27
versionName "1.0.19"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support.constraint:constraint-layout:1.0.2'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-crash:11.8.0'
compile 'com.google.android.gms:play-services-gcm:11.8.0'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:+'
compile 'com.liferay.mobile:liferay-screens:2.1.1'
compile 'com.liferay.mobile:liferay-material-viewset:2.1.1'
compile 'com.android.support:support-v4:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:cardview-v7:+'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.android.volley:volley:1.0.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:exifinterface:+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.woxthebox:draglistview:1.5.1'
compile 'com.github.lzyzsd:circleprogress:+'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
compile 'me.gujun.android.taggroup:library:1.4#aar'
compile 'com.akexorcist:RoundCornerProgressBar:2.0.3'
compile 'com.prolificinteractive:material-calendarview:1.4.3'
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/nhpatt/liferay-mobile" }
google()
}
}
apply plugin: 'com.google.gms.google-services'
Please anyone help to find out the solution.
It seems like a strange issue in Android Studio. Found a Workaround from this post.
Thanks to Veener who has posted the answer that actually solved the issue.
Just check whether the auto import libraries is working. Whether the studio is importing te required libraries in your maiƱ activity
getting the error "Error:Execution failed for task ':app:transformClassesWithDexForLegacyDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException"
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
// needed for okHttp from 23sdk. https://medium.com/android-news/android-networking-i-okhttp-volley-and-gson-72004efff196#.gsfpn3ez8
useLibrary 'org.apache.http.legacy'
dexOptions {
javaMaxHeapSize "3g"
}
defaultConfig {
applicationId "bf.io.openshop"
minSdkVersion 15
targetSdkVersion 23
versionCode 2
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled false
multiDexEnabled true
debuggable true
versionNameSuffix '-DEBUG'
}
release {
minifyEnabled false
debuggable true
}
}
testOptions {
unitTests.returnDefaultValues = true
}
productFlavors {
Modern {
minSdkVersion 23
}
Legacy {
minSdkVersion 15
}
}
sourceSets {
androidTest {
resources.srcDirs += ['src/androidTest/resources']
}
}
}
task clearData(type: Exec) {
def clearDataCommand = ['adb', 'shell', 'pm', 'clear', 'bf.io.openshop']
commandLine clearDataCommand
}
repositories { mavenCentral() }
dependencies {
// if needed jar libraries, add them to libs folder and load them here:
// compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.jakewharton.timber:timber:4.1.2'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'mbanje.kurt:fabbutton:1.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.9.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
compile 'com.android.support:multidex:1.0.0'
//// Unit testing dependencies
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-all:1.10.19'
// Set this dependency if you want to use the Hamcrest matcher library
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.powermock:powermock-module-junit4:1.6.4'
testCompile 'org.powermock:powermock-api-mockito:1.6.4'
//// Instrumentation test dependencies
androidTestCompile 'com.android.support:support-annotations:23.4.0'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
}
apply plugin: 'com.google.gms.google-services'
you can try to clean your project ,rebuild it .It maybe ok.
1.Try to clear cache and rebuild
At path file>clearcache>clear cache and restart
Add multidex support in app level gradle
multudex true inside defaultConfig like this
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
multiDexEnabled true
}
I am attempting to integrate Pushy (https://pushy.me/) into my app to allow for more reliable real-time notifications, in place of GCM.
However, upon attempting to run the app, the error below appears:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/fasterxml/jackson/core/base/GeneratorBase$1.class
Below is my build.gradle class:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1" // 22.0.1
defaultConfig {
applicationId "com.example.android.myapp2"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
dataBinding {
enabled = true
}
}
dependencies {
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.firebase:firebase-client-android:2.5.1+'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I have attempted to clean, rebuild, but nothing helps.
How can I alleviate this issue?
After contacting the support line, I simply needed to prevent duplicate references of the jackson library:
configurations {
all*.exclude group: 'com.fasterxml.jackson.core'
}
and changed the dependencies to:
dependencies {
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.firebase:firebase-client-android:2.5.1+'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile files('libs/pushy-1.0.7.jar') //** Specified **
}