I'd like to add CircularReveal library to my app. I have copied circualreveal folder to .../MyApplication/libs/.
This is my settings.gradle file
include ':app', ':libs:circualreveal'
But when I try to sync project with gradle files there is an error
\AndroidstudioProjects\MyApplication\libs\circualreveal\build.gradle
Error:(2, 0) Plugin with id 'android-maven' not found.
Here is \AndroidstudioProjects\MyApplication\libs\circualreveal\build.gradle file
apply plugin: 'com.android.library'
apply plugin: 'android-maven'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 21
}
}
dependencies {
compile 'com.nineoldandroids:library:2.4.0'
}
What am I doing wrong?
You need to add class path in your project build.gradle. It will look like this:
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
Related
I am completely new to realm. I want to use realm db in my android project. I have gone through the official Realm documentation. I need to set up realm in my android project. For that I have added the gradle dependancy as
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:0.88.2"
}
}
apply plugin: 'realm-android'
This is what they have given in documentation. But this doesn't work for me. It gives error saying Plugin with id 'realm-android' not found.
This is my build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.db.realmsample"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:0.88.2"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
}
Is my configuration correct?
Move the buildscript to your main build.gradle file (Project) , it shouldn't be there in build.gradle (module:app)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:<realm version>"
}
}
This should go to main build.gradle
First of all copy the class path dependency to build.gradle file(Project):-
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:1.2.0"
}
}
Finally, copy and paste the following code on top of build.gradle(App) :-
apply plugin: 'realm-android'
Note:- The version 1.2.0 is subjected to change on future releases.For more please check https://realm.io/docs/java/latest/
Prerequisites
Android Studio version 1.5.1 or higher
JDK version 7.0 or higher
A recent version of the Android SDK
Android API Level 9 or higher (Android 2.3 and above)
Step 1: Add the class path dependency to the project level build.gradle file.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:4.1.1"
}
}
Step 2: Apply the realm-android plugin to the top of the application level build.gradle file.
apply plugin: 'realm-android'
Step 3: Gradle sync
For the official complete installation guide. Please see the following link.
https://realm.io/docs/java/latest/#installation
The method I used is
` dependencies
{
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "io.realm:realm-gradle-plugin:3.1.4"
}`
in your main build gradle file
then add
apply plugin: 'realm-android'
and
compile 'io.realm:android-adapters:2.0.0'
in your app's build gradle
this link to bintray will give you the latest build
https://bintray.com/realm/maven/realm-android-library/3.4.0#files/io%2Frealm%2Frealm-android-library%2F3.4.0
I am using https://github.com/wasabeef/richeditor-android library in my android project. I tried adding it into my project by "compile 'jp.wasabeef:richeditor-android:0.3.0'" as mentioned on its page and it works perfectly in my project.
I wish to do some custom changes in that library. So I tried cloning the sample project over there and it is working fine.
But when I try to add the "richeditor" project folder from the sample code in my code and add "compile project('libs:richeditor')" in my app build.gradle and also add "include ':app:libs:richeditor'" in settings.gradle, it throws me an error "Error:Plugin with id 'com.jfrog.bintray' not found.".
P.S. I have put the richeditor project in app/libs/ folder.
How to solve this error or is there any other way I could make some custom changes to the above library?
build.gradle (app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 17
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories {
mavenCentral()
maven { url 'http://clinker.47deg.com/nexus/content/groups/public' }
jcenter()
}
dependencies {
compile files('libs/isoparser-1.0.2.jar')
compile project('libs:richeditor')
compile('com.fortysevendeg.swipelistview:swipelistview:1.0-SNAPSHOT#aar') {
transitive = true
}
compile 'com.android.support:support-v4:23.0.1'
compile 'com.github.satyan:sugar:1.3'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
}
build.gradle (richeditor)
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 17
targetSdkVersion 22
}
}
android.libraryVariants.all { variant ->
if (variant.buildType.isDebuggable()) {
return; // Skip debug builds.
}
task("javadoc${variant.name.capitalize()}", type: Javadoc) {
description "Generates Javadoc for $variant.name."
source = variant.javaCompile.source
ext.androidJar = System.getenv("ANDROID_HOME") + "/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
}
task("bundleJavadoc${variant.name.capitalize()}", type: Jar) {
description "Bundles Javadoc into zip for $variant.name."
classifier = "javadoc"
from tasks["javadoc${variant.name.capitalize()}"]
}
}
apply from: 'android-artifacts.gradle'
apply from: 'central-publish.gradle'
apply from: 'bintray-publish.gradle'
#Jay there is issue on classpath
see the file bintrya-public.gradle
the file apply the plugin 'com.jfrog.bintray'
whose classpath is defined in the file build.gradle
(whose scope is outside of the project/module 'richeditor')
Solution -
Import the module, then
Add
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'
into the build.gradle file of project under dependencies
Add the below lines into gradle.properties file of project
VERSION_NAME=1.0.0 VERSION_CODE=16 GROUP=jp.wasabeef
ARTIFACT_ID=richeditor-android COMPILE_SDK_VERSION=23
BUILD_TOOLS_VERSION=23.0.2 TARGET_SDK_VERSION=23 MIN_SDK_VERSION=14
POM_DESCRIPTION=RichEditor for Android is a beautiful Rich Text
WYSIWYG Editor POM_URL=https://github.com/wasabeef/richeditor-android
POM_SCM_URL=git#github.com:wasabeef/richeditor-android.git
POM_SCM_CONNECTION=git#github.com:wasabeef/richeditor-android.git
POM_SCM_DEV_CONNECTION=scm:git#github.com:wasabeef/richeditor-android.git POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo POM_DEVELOPER_ID=wasabeef
POM_DEVELOPER_NAME=Wasabeef
POM_DEVELOPER_EMAIL=dadadada.chop#gmail.com
POM_DEVELOPER_URL=wasabeef.jp
ISSUE_URL=https://github.com/wasabeef/richeditor-android/issues
SUPPORT_PACKAGE_VERSION=23.0.1
now, sync the project and enjoy the import
Change from "compile 'jp.wasabeef:richeditor-android:0.3.0'" to compile 'jp.wasabeef:richeditor-android:1.0.0' in build.gradle
See this link: https://github.com/wasabeef/richeditor-android#gradle
I'm trying to work with a project which has two modules, say M1 and M2. M1 should have M2 as a dependency. I've added a class Test to M2 which I want to access from M1.
I'm working with Android Studio 0.3.2. Whatever I try (reimporting project, sync gradle files, ..), I cannot access the Test class from M1: Cannot resolve symbol 'Test'.
Folder structure:
- root
- M1
- src
- build.gradle
- ...
- M2
- src
- build.gradle
- ...
- build.gradle
- settings.gradle
- ...
root/settings.gradle:
include ':M1', ':M2'
root/build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
root/M1/build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 19
targetSdkVersion 19
}
}
dependencies {
compile project(':M2')
}
root/M2/build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 19
targetSdkVersion 19
}
}
dependencies {
}
Running gradlew compileDebug gives:
root\M1\src\main\java\com\mypackage\m1\MainActivity.java:28: error: package com.mypackage.m2 does not exist
com.mypackage.m2.Test test;
^
What should I do to fix this problem?
Both your module apply the android application plugin with
apply plugin: 'android'
If M1 is to depend on M2, M2 must be a library project, and its gradle file should say
apply plugin: 'android-library'
I've referenced roboguice 2.0 in my new Android project build with Android Studio, here is my build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android-library'
repositories {
mavenCentral()
}
dependencies {
compile files('/libs/android-support-v4.jar')
compile 'org.roboguice:roboguice:2.0'
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 10
targetSdkVersion 16
}
}
Both gradle clean and gradle build run successfully but the IDE is reporting the error Element resources must be declared in roboguice.xml
Am I missing something or is this a bug in the IDE?
Mystery solved,
I've accidentally copied roboguice.xml to res/menu instead of res/values
I am having some problems with Android Studio 0.1.5.
My app compiles and runs on my device.
But the java source code is full of red errors with
Cannot resolve Symbol
This only seems to happen with components that are in libs (ex Roboguice)
Here is my build.gradle (though the problem looks more on Android Studio)
build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android'
dependencies {
compile files(
'libs/GoogleAdMobAdsSdk-6.3.1.jar',
'libs/gson-2.2.2.jar',
'libs/guice-3.0-no_aop.jar',
'libs/javax.inject-1.jar',
'libs/roboguice-2.0b4.jar',
'libs/roboguice-sherlock-1.0.jar',
)
compile project(':libraries:ActionBarSherlock')
compile project(':libraries:android-ColorPickerPreference')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
Do you have any hints?
Thanks.
I solved by selecting those libraries and then added as library.