BR cannot be resolved - android

I am not able to add notifyPropertyChanged(int itemId) because of certain issue in gradle, i guess!
any help would be well appreciated
public class RegisterForm extends BaseObservable {
#Bindable
public String firstName;
#Bindable
public int getFirstNameLabelVisibility(){
return TextUtils.isEmpty(firstName) ? View.INVISIBLE : View.VISIBLE;
}
public void setFirstNameFromView(String firstNameFromView) {
firstName = firstNameFromView;
// notifyPropertyChanged(BR.firstName); this line is giving error!
}
}
Build.gradle // for App
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
apply plugin: 'android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.jivrajsingh.databindingimp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
configurations {
apt
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
apt 'com.android.databinding:compiler:1.0-rc0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
}
Build.gradle // for project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.databinding:dataBinder:1.0-rc2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.+'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Thanks for your precious time :)

You have the old plugin setup with the new gradle version.
Remove the data binding plugin & its dependency from classpath.
Now it is integrated and all you need is
android {
dataBinding { enabled = true }
}
http://developer.android.com/tools/data-binding/guide.html

Related

Could not GET 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom'

Getting error while using Add Firebase Authentication to your App in the Firebase authentication (Assistant).
The error shows in the Sync tab as:
Could not GET 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom'. Received status code 405 from server: Method Not Allowed
Enable Gradle 'offline mode' and sync project
My Android Studio Details are:
Android Studio version 3.2.1
Gradle version: 4.6
build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/android/android-tools' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (App)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.nsc.suyog.myotp1"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
}
Try to change the following code (project):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven { url "http://jcenter.bintray.com"}
maven { url 'https://dl.bintray.com/android/android-tools' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "http://jcenter.bintray.com"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And (app):
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.nsc.suyog.myotp1"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
android { lintOptions { abortOnError false }
aaptOptions {
cruncherEnabled = false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-auth:16.1.0'
}
Also in gradle-wrapper.properties add this line or change if already exist with other value:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Just remove :15.0.0 from the firebase implementation!
The implementation should be like:
implementation 'com.google.firebase:firebase-auth:16.1.0'
Else every thing seems fine!

Error:Failed to resolve: com.google.android.gms

Error:Failed to resolve: com.google.android.gms:play-services-basement:[11.0.4]
Error:Failed to resolve: com.google.android.gms:play-services-tasks:[11.0.4]
When i used android studio 2.3.2 version my project build successfully but after updated to android studio version to 2.3.3 and updated google play services i am getting this error please help.
There is no play-services-basement and play-services-tasks folder in my folder
when i comment this "compile 'com.google.android.gms:play-services-location:11.0.4'" line my project compiling fine if i uncomment then my project not compiling
Project Gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
repositories {
jcenter()
}
}
ext {
compileSdkVersion = 25
buildToolsVersion = "25.0.2"
supportLibVersion = "25.3.1"
minSdkVersion = 14
targetSdkVersion = 25
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "package"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
debuggable true
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.github.beyka:androidtiffbitmapfactory:0.9.6.2'
debugCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
}
project gradle file:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}

Android Build Gradle giving complie() error

I am facing this error for a long time now..
Error:(24, 0) Could not find method compile() for arguments
[com.google.code.gson:gson:2.3] on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
My root build.gradle is
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
//apply plugin: 'com.android.application'
//
//android {
// compileSdkVersion 23
// buildToolsVersion '23.0.0'
//}
And my module/build.gradle is
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.zumoappname"
minSdkVersion 7
targetSdkVersion 17
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'aars'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.guava:guava:18.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.microsoft.azure:azure-mobile-android:3.1.0'
compile (group: 'com.microsoft.azure', name: 'azure-notifications-handler', version: '1.0.1', ext: 'jar')
}
Could somebody please direct me in the correct direction..
And before this I received a similar error for "android method"..
I googled a lot but was not of much use.
Thanks in advance:)
It seems that your file has some issue.
The structure should be:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig { ... }
buildTypes {
release {...}
}
}
repositories { .. }
dependencies {
//..
}
Move the repositories block outside the android block.

Cannot make Android databinding plugin work

I am trying to make use of the android databinding plugin with no luck so far.
I am using: Gradle 2.2.1; Intellij IDEA 15.
Project level build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath "com.android.databinding:dataBinder:1.0-rc2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Module build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
buildscript {
repositories {
jcenter()
}
dependencies {
}
}
repositories {
jcenter()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.app4.app4"
minSdkVersion 10
targetSdkVersion 10
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
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.1.1'
}
I got few different errors while trying to change plugins' versions; the error I am getting now is "Error:Gradle: A problem occurred configuring project ':app4'.
Failed to notify project evaluation listener.
android.databinding.tool.LayoutXmlProcessor.(Ljava/lang/String;Landroid/databinding/tool/writer/JavaFileWriter;IZLandroid/databinding/tool/LayoutXmlProcessor$OriginalFileLookup;)V"
With the new version of the data binding library, you don't explicitly add the databinding dependency then apply it. All you need is dataBinding{enabled = true;} Other concerns: your target SDK version should probably not be 10 at this point.
Example:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
allprojects {
repositories {
jcenter()
}
}
and
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.yourappname"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true;
}
}
dependencies {
//other dependencies
}
I don't recall if the neenbedankt gradle plugin is strictly necessary, but it's very useful for compile time annotation processing.

issue to add a repository from android arsenal

I am trying to add a PinnedSectionListView from android arsenal.
the way to add say:
Add the specific repository to your build file:
repositories {
maven {
url "https://jitpack.io"
}
}
Add the dependency in your build file (do not forget to specify the correct qualifier, usually 'aar'):
dependencies {
compile 'com.github.beworker:pinned-section-listview:v1.0'
}
so i did that (build.gradle (Project)):
buildscript {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module): apply plugin: 'com.android.application'
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.jonathandg.listviewsections"
minSdkVersion 16
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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.beworker:pinned-section-listview:v1.0#aar'
//compile 'com.beworker:pinned-section-listview:v1.0'
}
then the android studio message is
Error:(25, 13) Failed to resolve: com.beworker:pinned-section-listview:v1.0
The repositoty is in: https://android-arsenal.com/details/1/264
Try below Gragle dependency line
compile 'com.github.beworker:pinned-section-listview:1.1'

Categories

Resources