I'm trying to implement the MVVM architecture using Robobinding. Here's the link I'm following for the Environment setup of Robobinding in Android Studio(without AspectJ):
http://robobinding.github.io/RoboBinding/getting_started.html#_android_studio
This is what my app level Build.gradle looks like after adding the dependencies:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.simpletimerapp"
minSdkVersion 14
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.1'
compile "org.robobinding:robobinding:${robobindingVersion}"
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.+'
}
}
The problem is gradle build fails with the following error:
Error:(26, 0) Could not find property 'robobindingVersion' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated#2ccd2d42.
Open File
EDIT 1:
On replacing ${robobindingVersion} in the dependencies block with 0.8.12 (latest version of robobinding), gradle build finishes successfully. But now, I'm unable to use the "bind" attribute in the views in my layout files. This is the error:
Unexpected namespace prefix "bind" found for tag TextView
EDIT 2:
Still can't find the solution. So, I downloaded this minimal android app (from their official github page) which implements robobinding and edited it to create my own app. It's working fine now.
Related
I'm trying to get into developing using android studio, so I recently tried to run a simple login-activity app on it. Basically, what I did was just run the setup for a new android studio project, and selected loginactivity as my default screen. I configured the emulator and hit sync gradle, but it gave me the following response:
image
I downloaded the repository that was required and tried to sync the gradle again, but it again asked exactly the same thing! Please help!
my gradle file for the app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.fyp.fingerpay"
minSdkVersion 23
targetSdkVersion 27
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.google.android.gms:play-services:10.2.6'
compile 'com.android.support:appcompat-v7:27.+'
}
I think you have forgot to add maven repository in your app gradle file.
Try by doing these steps.
Open the build.gradle file for your application.
Make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint. For example:
allprojects {repositories {jcenter()maven {url "https://maven.google.com"}}}
Avoid using + in your dependencies as it android studio will try to update dependencies every 24 hours.
Also replace compile by implementation for low APK size.
Upgraded to:
Android Studio 3.0 Canary 2
com.android.tools.build:gradle:3.0.0-alpha2
I have a multi-module project (main app + sub modules)
Inclusion inside the main app:
dependencies {
implementation project(path: ':testlib', configuration: 'default')
}
The testlib is defined as a simple android library project and works normally when included with gradle 2.3.0 and via compile project(path: ':testlib')
I get the following gradle error message:
Could not resolve all dependencies for configuration ':app:devDebug_signedCompileClasspath'.
Selected configuration 'default' on 'project :testlib'
but it can't be used as a project dependency because
it isn't intended for consumption by other components.
What does "isn't intended for consumption by other components" mean in this context? The module is defined as an android library.
Here is the build.gradle of the testlib:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
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'])
}
What am I missing?
I also got this error. Android Studio 3.0 Canary 4 just came out. I updated to it, which also updates gradle to 4.0rc1.
The problem went away on it's own.
alter your Top-level build file (aka root gradle)
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
still not working?
update dist-url (inside gradle-wrapper.properties)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-rc-1-all.zip
I want to use this library in a project in Android Studio, so as mentioned in read me, I created new project in the Android Studio and added dependencies in build.gradle file inside the app folder as:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.mycompany.swipe_instagram"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.lorentzos.swipecards:library:1.0.8#aar'
}
Then when I sync I started getting this error as:
I have Searched on the google and stack overflow but can't find any appropriate solution.
I used your "build.gradle" file and it is working fine for me (both with and without "aar"). Could be something wrong with the cache. Try "File -> Invalidate Caches / Restart"). Another way to generate more error message detail is to try building the module from the command line and getting verbose output
gradle -info compileDebugSources
You'll get lots of output which should give you a hint as to what's going wrong
Since downloading the new Android Studio Beta I have a problem with my (professional) apps that have the Crashlytics plugin enabled.
Since the new IDE version/Gradle version they can't compile at all anymore. It's either the app:debugCompile or app:releaseCompile proces that takes ages and never gets resolved. (Yesterday I let it compiling for 3 hours and it never finished).
I even tried setting up a fresh new Android project as a test without any additions which off course ran fine, but once I added Crashlytics the problem described earlier showed up again.
I can't be the only one with this problem, can I? Or am I missing something?
This is the Gradle file of my test project, the Crashlytics part is added with the AS plugin
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 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.yungpanda.testprojectfortest"
minSdkVersion 9
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'])
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.crashlytics.android:crashlytics:1.+'
}
I have been using AndriodAnnotations with Eclipse (ADT) without any issue. Recently, I decided to explore Android Studio. Using Android Studio with AndroidAnnotations has a few issues when I build the app. Below is the error:
I can run the app without any issues when it is showing three errors.
Below is my build.gradle:
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2+'
}
}
apply plugin: 'android'
apply plugin: 'android-apt'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.test.restaurantmenu"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apt {
arguments {
androidManifestFile variant.processResources.manifestFile
resourcePackageName "com.test.restaurantmenu"
}
}
dependencies {
apt "org.androidannotations:androidannotations:3.0+"
compile "org.androidannotations:androidannotations-api:3.0+"
compile 'com.android.support:appcompat-v7:+'
compile 'com.github.satyan:sugar:1.3'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I've enabled the annotation processors as follow:
Is there any steps I missed or wrong in my setup?
I installed "Android SDK Tools 23.0.2" and all the errors were solved.
if you're using kotlin and you're getting an error showing
error: annotations are not supported in -source 1.3 (use -source 5 or
higher to enable annotations)
There is a workaround for it
Open Project Structure (File -> Project Structure). Select the module.
Change the source compatibility and Target compatibility from kotlin 1.3
to jdk 1.8