Sync failed - Error about DatabindingBuilder - java

Why isn't my project running when I click on "run"?
I get this panel:
BUILD.GRADLE:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "info.androidhive.materialtabs"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding{
enabled = true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile files('libs/tinydb-0.0.9.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/gson-2.2.2.jar')
compile files('libs/jipsi.jar')
// compile 'com.android.support:appcompat-v7:23.1.1'
// compile 'com.android.support:design:23.1.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'net.gotev:uploadservice:2.1'
compile files('libs/jipsi_055b734e299151494aa487f8b477464882efb509.jar')
//compile 'com.android.support:design:23.3.0'
}
AND
LOGCAT

Make sure that in your project level build.gradle jcenter () is added like this
allprojects { repositories { mavenCentral() jcenter() }}
Also check this
Gradle couldn't find com.android.databinding:dataBinder:1.0-rc0
This will be of help to you.

Related

Gradle project sync failed.Basic functionality will not work properly

I run my project I get this error:Gradle project sync failed.Basic functionality will not work properly
LOGCAT:
This is my gradle-wrapper.properties
#Tue Sep 05 19:53:08 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
This is build.gradle(project):
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
This is build.gradle(Module app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "info.androidhive.materialtabs"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile files('libs/tinydb-0.0.9.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/gson-2.2.2.jar')
compile files('libs/jipsi.jar')
// compile 'com.android.support:appcompat-v7:23.1.1'
// compile 'com.android.support:design:23.1.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'net.gotev:uploadservice:2.1'
compile files('libs/jipsi_055b734e299151494aa487f8b477464882efb509.jar')
//compile 'com.android.support:design:23.3.0'
}
Project structure-> Project:
You are using the Data Binding Library.
To use it, add in your module/build.gradle in the android block:
dataBinding {
enabled = true
}
More info here.

Could not find support-v4.aar(com.android.support:support-v4:24.1.1)

The project is one of Google samples on Github, Androidtv-Leanback. I cloned it and opened with Android studio, but build fails.
Error:
Could not find support-v4.aar(com.android.support:support-v4:24.1.1)
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24'
defaultConfig {
applicationId "com.example.android.tvleanback"
minSdkVersion 21
targetSdkVersion 24
versionCode 2
versionName "1.3"
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'])
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:leanback-v17:24.1.1'
compile 'com.android.support:recommendation:24.1.1'
compile 'com.android.support:preference-leanback-v17:24.1.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.robolectric:robolectric:3.1'
androidTestCompile 'com.android.support:support-annotations:24.1.1'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
compile 'com.google.android.exoplayer:exoplayer:r1.5.8'
// compile files('src/libs/android-support-v4.jar')
}
add this dependency in your build.gradle file
dependencies {
...
compile "com.android.support:support-v4:24.2.1"
}
and make sure you have downloaded the android support repository using sdk manager.

I am trying to use junit with apt plugin

I am trying to use JUnit in my android app. I have this build.gradle/app configuration:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.myproject.tv"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories { jcenter() }
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12' //added
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:leanback-v17:23.2.0'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.github.bumptech.glide:glide:3.4.+'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.danikula:videocache:2.3.3'
compile 'org.androidannotations:androidannotations-api:3.3.2'
apt 'org.androidannotations:androidannotations:3.3.2'
compile 'com.google.dagger:dagger:2.0.2'
apt 'com.google.dagger:dagger-compiler:2.0.2'
provided 'org.glassfish:javax.annotation:10.0-b28'
}
When I run the application:
Error:(28, 0) Cannot get property 'processResources' on null object
Open File
The line 28 is:
26 apt {
27 arguments {
28 androidManifestFile variant.outputs[0].processResources.manifestFile
29 resourcePackageName android.defaultConfig.applicationId
30 }
31}
How do I fix this problem in my gradle ???
Try this. It worked for me.
<pre><code>
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
</code></pre>
I met the same problem
Delete testCompile 'junit:junit:4.12' //added
then sync you will fix

Dagger 2: java.lang.NoSuchMethodError

Can't build project with Dagger 2 (Android Studio 1.3).
Step 1. Add dependencies to build.gradle
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
Full build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:design:22.2.+'
compile 'com.android.support:palette-v7:22.2.+'
compile 'com.afollestad:material-dialogs:0.7.8.1'
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
compile 'org.androidannotations:androidannotations:3.0.+'
compile 'org.androidannotations:androidannotations-api:3.0.+'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile files('libs/gson-2.2.jar')
}
Step 2.
Just add annotation #Inject or #Module to code and get compile error.
Error:Execution failed for task ':app:compileDebugJava'.
java.lang.NoSuchMethodError: com.google.common.collect.Multimaps.filterKeys(Lcom/google/common/collect/SetMultimap;Lcom/google/common/base/Predicate;)Lcom/google/common/collect/SetMultimap;
Any ideas?
Update
I'm create new project.
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile files('libs/gson-2.2.jar')
}
And it compile fine. When I add to libs guava-r07.jar I get like compile error. I think the problem relate with guava.
Solved
Remove guava-r07.jar from libs.
Add to build.gradle
compile 'com.google.guava:guava:13.0.1'

Error:Execution failed for task ':app:preDexDebug'. > ... finished with non-zero value 1

I add a library to my project,but the library has some jar packages that i have used in my app,so it comes out the error "finished with non-zero value 2",after i modify the jar packages version,it comes out the error "Error:Execution failed for task ':app:preDexDebug'. > ... finished with non-zero value 1",i dont konw how to solve it 。
the app buidle.gradle :
`apply plugin: 'com.android.application'
android {
packagingOptions{
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
abortOnError false
}
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.fengmanlou.logintest"
minSdkVersion 14
targetSdkVersion 21
versionCode 2
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.0.0'
compile project(':slibingtab')
compile project(':leanchatlib')
compile files('libs/weibo.sdk.android.sso.jar')
compile files('libs/Java-WebSocket-1.2.0-leancloud.jar')
compile files('libs/qq.sdk.1.6.1.jar')
compile files('libs/httpmime-4.2.4.jar')
compile files('libs/fastjson-1.1.37-leancloud.jar')
compile files('libs/avoscloud-statistics-v3.1.1.jar')
compile files('libs/avoscloud-sdk-v3.1.4.jar')
compile files('libs/avoscloud-push-v3.1.4.jar')
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/android_api_1.1_forsdk.jar')
compile files('libs/BaiduLBS_Android.jar')
compile files('libs/galaxy_mini.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/avoscloud-sns-v3.1.1.jar')
compile files('libs/avoscloud-search-v3.1.1.jar')
compile files('libs/weibosdkcore.jar')
compile files('libs/litepal.xml-1.2.0.jar')
compile project(':pulltorefresh')
compile files('libs/avoscloud-feedback-v3.1.1.jar')
compile files('libs/jsoup-1.8.1.jar')
compile project(':slibingmenu')
} `
the library build.gradle :
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.0.0'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/avoscloud-push-v3.1.4.jar')
compile files('libs/avoscloud-sdk-v3.1.4.jar')
compile files('libs/butterknife-6.1.0.jar')
compile files('libs/eventbus-2.4.0.jar')
compile files('libs/fastjson-1.1.37-leancloud.jar')
compile files('libs/httpmime-4.2.4.jar')
compile files('libs/Java-WebSocket-1.2.0-leancloud.jar')
compile files('libs/prettytime-3.2.5.Final.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
}
this is the first time i use stackoverflow to ash question,please tell me how to solve it .thank you!
I also dont know how to solve the problem.but the project is built successfully.There is a jar package that cant be opened. I delete it and add the jar package from other project.it works.

Categories

Resources