tikxml and Gradle - android

I'm trying to use tikxml library.
I put this in build.gradle (app) :
apply plugin: 'com.neenbedankt.android-apt'
...
dependencies {
...
// tikxml
compile "com.tickaroo.tikxml:annotation:${libs.tikxml}"
compile "com.tickaroo.tikxml:core:${libs.tikxml}"
apt "com.tickaroo.tikxml:processor:${libs.tikxml}"
}
And this in my build.gradle (project) :
buildscript {
...
dependencies {
...
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
ext {
libs = [tikxml : '0.8.9-SNAPSHOT']
}
But I'm getting this error when I build the project :
Error:Could not find com.tickaroo.tikxml:processor:0.8.9-SNAPSHOT.
Searched in the following locations:
file:/opt/android-sdk/extras/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/maven-metadata.xml
file:/opt/android-sdk/extras/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.pom
file:/opt/android-sdk/extras/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.jar
file:/opt/android-sdk/extras/google/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/maven-metadata.xml
file:/opt/android-sdk/extras/google/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.pom
file:/opt/android-sdk/extras/google/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.jar
file:/opt/android-sdk/extras/android/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/maven-metadata.xml
file:/opt/android-sdk/extras/android/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.pom
file:/opt/android-sdk/extras/android/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.jar
file:/opt/android-studio/gradle/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/maven-metadata.xml
file:/opt/android-studio/gradle/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.pom
file:/opt/android-studio/gradle/m2repository/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.jar
https://jcenter.bintray.com/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.pom
https://jcenter.bintray.com/com/tickaroo/tikxml/processor/0.8.9-SNAPSHOT/processor-0.8.9-SNAPSHOT.jar
Required by:
LVS.Training.Android.Lab.SimpleEpubReader:app:unspecified
I have no folder named m2repository in /opt/android-sdk/extras/. I checked the URL where Gradle tried to download the library (https://jcenter.bintray.com/com/tickaroo/tikxml/ and there no tickaroo subdir in com : https://jcenter.bintray.com/com/
Anybody knows if there is a problem with this library ?

Since this is a SNAPSHOT release (which means it is not a stable 1.0 release),
you have to include the snapshot repository url in your build.gradle file (from where com.tickaroo.tikxml:processor:0.8.9-SNAPSHOT etc. will be downloaded):
You have to add the url "http://oss.sonatype.org/content/repositories/snapshots" to your repositories section of your root build.gradle file:
repositories {
mavenCentral()
maven {
url 'http://oss.sonatype.org/content/repositories/snapshots'
}
}

Related

Android Studio - Build fails on compile, cannot find dsl.dependencies.DefaultDependencyHandler

Here's build.gradle:
C:\Users\billb\StudioProjects\ShoppingList03>type build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath "/com.android.tools.build.gradle:3.3/"
compile "com.android.support:support-core-utils:26.1.0"
}
}
allprojects {
repositories {
jcenter()
}
}
Error is on the compile: cannot find DefaultDependencyHandler.
I've reloaded Android SDK Platform-Tools and SDK Tools, both 26.0.1
Where is this DefaultDependencyHandler? Why is it required?
There's something in my android java code that requires this, evidently.
Any ideas out there? I've spent way too much time trying to track this down.
Add compile "com.android.support:support-core-utils:26.1.0" line in your app level build.gradle file instead of project level build.gradle file.

Resolving Artifacts from bintray via gradle (non jcenter)

I've deployed artifact to bintray as it whitten in documentation (using their plugin). All looks fine. It is opened in browder, structure looks fine: https://dl.bintray.com/flymob/maven/
Now I want to use it via gradle in Android Studio before publishing to jcenter(). I've read their documentation https://bintray.com/docs/usermanual/formats/formats_mavenrepositories.html#_working_with_gradle
I've tried:
buildscript {
repositories {
jcenter()
maven {
url "https://dl.bintray.com/flymob/maven"
}
}
}
and
compile 'flymob-sdk-sample:FlyMobSdk:1.3.0'
or
compile 'flymob-sdk-sample:FlyMobSdk:1.3.0#aar'
I'm getting error:
Failed to resolve: flymob-sdk-sample:FlyMobSdk:1.3.0
What am I doing wrong?
you added "https://dl.bintray.com/flymob/maven" inside the buildscript section. Those are the repos used by the buildscript (a.k.a. gradle script) only. Those are the repos where the system will find the plugins from apply plugin
to fix it is easy. Just move it to the repositories on the "root" of the script. Something like:
buildscript {
repositories {
// repos for the build script
jcenter()
... etc
}
dependencies {
// dependencies from the plugins from the build script
classpath 'com.android.tools.build:gradle:2.1.2'
... etc
}
}
apply plugin: 'android-sdk-manager'
apply plugin: ... etc
repositories {
jcenter()
maven { url "https://dl.bintray.com/flymob/maven" } <<<<< HERE
}
dependencies {
compile ... etc

Error:Plugin with id 'com.github.dcendents.android-maven' not found

I'm using this library in my Android app. (https://github.com/yazeed44/MultiImagePicker)
Before now, I was adding it to my project this way:
compile 'net.yazeed44.imagepicker:imagepicker:1.3.0'
The problem with importing it that way is, as far as I know, that I can't override any code because I'll lose all the changes after building the project again. (I need to change some code)
For that reason, I have downloaded the source code and I've imported the project as a module with this name: 'imagepicker'
After that, I added this line to my app build.gradle:
compile project(':imagepicker')
and this to my settings.gradle (Android Studio did it)
include ':app', ':imagepicker'
After doing that, I try to run the project and Android studio shows this error:
Gradle 'Project' project refresh failed
Error:Plugin with id 'com.github.dcendents.android-maven' not found.
Since you are using the module locally you have to add in your top-level build.gradle or in the imagepicker/build.gradle same config added in the imagepicker build.gradle project.
buildscript {
repositories {
jcenter()
}
dependencies {
//ADD THESE DEPENDENCIES
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
An alternative can be modify the imagepicker/build.gradle removing the last 2 lines. But you have to test this way.
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
If you check these files you will find the
apply plugin: 'com.github.dcendents.android-maven'
In your case you don't need these files because they are useful only to uplaod in a maven repo the aar file.
I added below code in Project:gradle.build file and its resolved the problem :
allprojects {
repositories {
jcenter()
maven {
url "https://repo.commonsware.com.s3.amazonaws.com"
}
}
}
EDIT
If you still facing after adding above maven dependencies
Change url "https://repo.commonsware.com.s3.amazonaws.com" to url "https://s3.amazonaws.com/repo.commonsware.com".

Gradle plugin 'com.android.library' does not search in custom maven repositories

Here is how my application module 'app' build gradle looks like:
apply plugin: 'com.android.application'
repositories {
maven { url 'http://localhost:8080/repository/internal/' }
}
...
dependencies {
compile 'org.apache.httpcomponents:httpmime:4.2.3'
compile 'com.testpackage.networking:networking:1.0.3'
}
and it works just fine. I'm trying to use same dependency in my library module named 'librarymodule'. Here is how its build.gradle looks like:
apply plugin: 'com.android.library'
repositories {
maven {
url 'http://localhost:8080/repository/internal/'
}
}
...
dependencies {
compile 'org.apache.httpcomponents:httpmime:4.2.3'
compile 'com.testpackage.networking:networking:1.0.3'
}
The only difference is gradle plugin 'com.android.library' used here vs 'com.android.application' used in 'app' module.
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.testpackage.networking:networking:1.0.3.
Searched in the following locations:
https://jcenter.bintray.com/com/testpackage/networking/networking/1.0.3/networking-1.0.3.pom
https://jcenter.bintray.com/com/testpackage/networking/networking/1.0.3/networking-1.0.3.jar
file:/Users/myusername/Library/Android/sdk/extras/android/m2repository/com/testpackage/networking/networking/1.0.3/networking-1.0.3.pom
file:/Users/myusername/Library/Android/sdk/extras/android/m2repository/com/testpackage/networking/networking/1.0.3/networking-1.0.3.jar
file:/Users/myusername/Library/Android/sdk/extras/google/m2repository/com/testpackage/networking/networking/1.0.3/networking-1.0.3.pom
file:/Users/myusername/Library/Android/sdk/extras/google/m2repository/com/testpackage/networking/networking/1.0.3/networking-1.0.3.jar
Required by:
LibrariesApplication:app:unspecified > LibrariesApplication:librarymodule:unspecified
So, for some reason there is no http://localhost:8080/repository/internal/com/testpackage/networking/networking/1.0.3/networking-1.0.3.pom under Searched in the following locations list.
It's not only my repository problems. I can for example use
maven { url 'https://mint.splunk.com/gradle/' }
repository with dependency
compile 'com.splunk.mint:mint:4.1'
and still getting similar error
Does anyone knows how to fix that?
This is a bit strange but adding custom repository to 'allprojects' of root build.gradle actually worked!
allprojects {
repositories {
jcenter()
maven {
url 'http://localhost:8080/repository/internal/'
}
}
}
If you don't want to put the maven credentials in the project file (and you shouldn't), create a "gradle.properties" file in your home directory and put the maven credentials in that file, like:
mavenUser=myUser
mavenPassword=myPassword
Then, in your build.gradle file, use as follows:
maven {
credentials {
username mavenUser
password mavenPassword
}
url http://my.maven.url
}

Gradle: Could not find actionbarsherlock #aar in a library project

I have a build.gradle file in my library project, the content of it looks like below:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android-library'
repositories {
mavenCentral()
}
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:18.0.+'
.......
when I do gradle build, it gives error:
Could not find com.actionbarsherlock:actionbarsherlock:4.4.0.
If I change the line "apply plugin" from 'android-library' to 'android', it can compile fine.
So is it a bug with the gradle android plugin? that it cannot find actionbarsherlock correctly in maven repository if it's from a library project?
Make sure you select from Project Settings -> Gradle, "Use local gradle distribution" pointing to you local Gradle copy. Mine is 1.9 and I managed to make it work.

Categories

Resources