Is it possible to adapt AndroidAnnotations Maven setup into Gradle?
http://code.google.com/p/androidannotations/wiki/MavenEclipse
I can't seem to make it work I keep getting com.sun.codemodel#codemodel;2.5-FROZEN-AA: not found
So far I have this
description = "App"
abbreviation = "App"
version = '1.0.0.BUILD-SNAPSHOT'
buildscript {
repositories {
mavenRepo name: 'gradle-android-plugin', urls: 'http://jvoegele.com/maven2/'
mavenRepo name: 'androidannotations', urls: 'http://repository.excilys.com/content/repositories/releases/'
}
def gradleAndroidPluginVersion = '1.0.0'
dependencies {
classpath "com.jvoegele.gradle.plugins:android-plugin:$gradleAndroidPluginVersion"
}
}
apply plugin: 'android'
apply plugin: 'eclipse'
apply plugin: 'idea'
def compatibilityVersion = 1.6
sourceCompatability = compatibilityVersion
targetCompatibility = compatibilityVersion
repositories {
mavenCentral()
mavenRepo urls: 'http://maven.springframework.org/snapshot'
mavenRepo urls: 'http://maven.springframework.org/milestone'
}
def roboguiceVersion = '1.1.1'
def guiceVersion = '2.0-no_aop'
def springAndroidVersion = '1.0.0.M4'
def commonsHttpClientVersion = '3.1'
def jacksonMapperVersion = '1.8.5'
def androidAnnotationsVersion = '2.1'
dependencies {
compile "org.roboguice:roboguice:$roboguiceVersion"
compile "com.google.inject:guice:$guiceVersion"
compile "org.springframework.android:spring-android-rest-template:$springAndroidVersion"
compile "commons-httpclient:commons-httpclient:$commonsHttpClientVersion"
compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonMapperVersion"
compile "com.googlecode.androidannotations:androidannotations:$androidAnnotationsVersion"
compile group: 'com.googlecode.androidannotations', name: 'androidannotations', version: '2.1', classifier: 'api'
runtime files('lib/server-standalone.jar')
}
sourceSets {
main {
java {
srcDir 'src'
}
}
}
clean {
delete 'gen'
}
idea {
module {
downloadJavadoc = true
}
project {
javaVersion = 'Android 2.2 Platform'
}
}
androidProcessResources.dependsOn(clean)
eclipse.dependsOn(cleanEclipse)
idea.dependsOn(cleanIdea)
defaultTasks 'assemble'
As a first pointer, I can't see the declaration of the maven repository that hosts the androidannotations lib.
you should add http://repository.excilys.com/content/repositories/releases as a maven Repo:
...
repositories {
mavenCentral()
mavenRepo urls: 'http://maven.springframework.org/snapshot'
mavenRepo urls: 'http://maven.springframework.org/milestone'
mavenRepo urls: 'http://repository.excilys.com/content/repositories/releases'
}
...
regards
Okay I managed to solve it
I had to add
repositories {
mavenCentral()
mavenRepo urls: 'http://maven.springframework.org/snapshot'
mavenRepo urls: 'http://maven.springframework.org/milestone'
mavenRepo urls: 'http://repository.excilys.com/content/repositories/releases'
mavenRepo urls: 'http://repository.excilys.com/content/repositories/thirdparty'
}
springAndroidVersion = '1.0.0.M4'
commonsHttpClientVersion = '3.1'
jacksonVersion = '1.8.5'
androidAnnotationsVersion = '2.1.1'
dependencies {
compile "org.springframework.android:spring-android-rest-template:$springAndroidVersion"
compile "commons-httpclient:commons-httpclient:$commonsHttpClientVersion"
compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion"
compile "com.googlecode.androidannotations:androidannotations:$androidAnnotationsVersion"
compile "com.googlecode.androidannotations:androidannotations:$androidAnnotationsVersion:api"
}
Related
I trying to Import my project in android studio 3.3.2 (latest version) but The IDE tell couldn't find (or download ) this plugin! I checked internet connection, firewall and other involving But can't figure it out why android studio cant download or find this plugin.
Note: I can download files by pasting link in chrome.
CONFIGURE FAILED in 8s
ERROR: Could not find com.google.android.gms:oss-licenses-plugin:0.9.4.
Searched in the following locations:
https://maven.google.com/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.pom
https://maven.google.com/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.jar
https://jcenter.bintray.com/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.pom
https://jcenter.bintray.com/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.jar
https://dl.google.com/dl/android/maven2/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.pom
https://dl.google.com/dl/android/maven2/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.jar
Required by:
project :
So this is my gradle config ( app-level ) :
apply plugin: 'com.android.application'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.sherdle.universal"
minSdkVersion 16
targetSdkVersion 27
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
//Optionally configure your OneSignal IDs below
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "",
onesignal_google_project_number: ""]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
jumboMode true
}
}
repositories {
flatDir {
dirs 'libs'
}
maven {
url "https://jitpack.io"
}
jcenter()
google();
}
dependencies {
implementation 'com.devbrackets.android:exomedia:4.0.3' //TV
implementation 'com.google.android.exoplayer:exoplayer:r2.4.3' //TV & Radio
implementation 'com.cleveroad:audiovisualization:1.0.0' //Radio
implementation 'com.google.code.gson:gson:2.8.0' //WC
implementation 'com.squareup.okhttp3:okhttp:3.7.0' //WC
implementation 'org.jsoup:jsoup:1.8.3'
implementation 'com.onesignal:OneSignal:[3.9.3,4.0.0)'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.duolingo.open:rtl-viewpager:1.0.2'
implementation 'com.github.chrisbanes:PhotoView:1.3.0'
implementation 'com.android.support:multidex:1.0.3'
implementation "com.android.support:cardview-v7:$supportlib_version"
implementation "com.android.support:appcompat-v7:$supportlib_version"
implementation "com.android.support:recyclerview-v7:$supportlib_version"
implementation "com.android.support:design:$supportlib_version"
implementation "com.android.support:support-v4:$supportlib_version"
implementation "com.android.support:support-core-utils:$supportlib_version"
implementation "com.android.support:support-media-compat:$supportlib_version"
implementation "com.google.android.gms:play-services-oss-licenses:$gps_version"
implementation "com.google.android.gms:play-services-gcm:$gps_version"
implementation "com.google.android.gms:play-services-ads:$gps_version"
implementation "com.google.android.gms:play-services-maps:$gps_version"
implementation 'com.google.maps.android:android-maps-utils:0.5+'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
My project Gradle config is this ( NOT APP-LEVEL ) :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
maven {
url 'https://jitpack.io'
}
}
}
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:3.2.1'
classpath 'com.google.android.gms:oss-licenses-plugin:0.9.4'
}
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
google()
}
}
ext {
supportlib_version = '27.1.1'
gps_version = '15.0.0'
}
//Ensure that all dependencies use the same version of the Android Support library
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$supportlib_version"
}
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$gps_version"
}
if (details.requested.group == 'com.google.firebase'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$gps_version"
}
}
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
google()
}
}
}
In your root-level build.gradle make sure you are using the Google Maven repository and add the oss-licenses plugin to your dependencies:
buildscript {
repositories {
// ...
google() // maven { url "https://maven.google.com" } for Gradle <= 3
}
dependencies {
// ...
// Add this line:
classpath 'com.google.android.gms:oss-licenses-plugin:0.9.4'
}
In your app-level build.gradle, apply the plugin by adding the following line under the existing apply plugin: 'com.android.application' at the top of the file:
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
In my case i was behind A proxy . Problem Solved by using FOD proxy Services Click for more info! in Android Studio And Everything worked fine .
I am updating my project's Gradle plugin from 2.1.2 to 3.1.0 but the gradle starts throwing error while build :
Cannot create variant 'android-lint' after configuration
':app:debugRuntimeElements' has been resolved
project level gradle :
// Top-level build file
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'org.ajoberstar:gradle-git:0.6.3'
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:1.+'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'com.google.gms:google-services:3.0.0'
}
}
// Used to disable preDex, will speed up clean build but slow down incremental builds.
project.ext.preDexLibs = !project.hasProperty('disablePreDex')
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
}
}
allprojects {
repositories {
jcenter()
}
}
library level gradle :
apply plugin: 'com.android.library'
setVersion '1.2'
repositories {
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
configurations {
classpaths
}
def sharedManifest = manifest {
attributes('Specification-Title': 'My App',
'Specification-Version': '2.1',
'Specification-Vendor': 'App Vendor',
'Implementation-Title': 'App',
'Implementation-Version': '2.1',
'Implementation-Vendor': 'App Vendor')
}
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 27
consumerProguardFile file("proguard-project.txt")
}
buildTypes {
debug {
testCoverageEnabled true
}
}
// work-around for duplicate files during packaging of APK
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation project(':exclude-doclet')
implementation 'com.android.support:support-annotations:27.0.2'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'commons-io:commons-io:2.4'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
implementation 'com.google.code.gson:gson:2.4'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.1.7'
classpaths files(new File(System.getenv("ANDROID_HOME") + "/platforms/android-${Integer.parseInt(rootProject.ANDROID_BUILD_SDK_VERSION)}/android.jar"),
new File(System.getenv("ANDROID_HOME") + "/extras/android/support/v4/android-support-v4.jar"))
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'org.mockito:mockito-core:1.10.19'
}
android.libraryVariants.all { variant ->
String name = variant.buildType.name
task("generate${name.capitalize()}Javadoc", type: Javadoc) {
dependsOn variant.javaCompiler
description "Generates Javadoc for $project.name."
title "App $project.version"
source = variant.javaCompiler.source
classpath += project.files(variant.javaCompiler.classpath.files, android.getBootClasspath())
List<File> pathList = new ArrayList<File>()
pathList.add(new File(project(':exclude-doclet').libsDir,
"ExcludeDoclet-${project(':exclude-doclet').version}.jar"))
options {
doclet = "ExcludeDoclet"
docletpath = pathList
encoding = "UTF-8"
classpath = configurations.classpaths.files.asType(List)
linksOffline "http://developer.android.com/reference", "${android.sdkDirectory}/docs/reference"
links "http://docs.oracle.com/javase/7/docs/api/",
"http://square.github.io/retrofit/2.x/retrofit/",
"http://square.github.io/okhttp/2.x/okhttp/",
"http://reactivex.io/RxJava/javadoc/"
memberLevel = JavadocMemberLevel.PUBLIC
header = "AppKit"
}
exclude '**/BuildConfig.java'
exclude '**/R.java'
failOnError true
doLast {
copy {
from 'src/javadoc/assets/'
into destinationDir.path + '/assets/'
}
}
}
task("assemble${name.capitalize()}JavadocJar", type: Jar) {
dependsOn "generate${name.capitalize()}Javadoc"
description "Assembles Jar contaning Javadoc for $project.name."
from project.tasks.getByName("generate${name.capitalize()}Javadoc").destinationDir
classifier = 'javadoc'
manifest {
from sharedManifest
}
}
task("assemble${name.capitalize()}Jar", type: Jar) {
dependsOn variant.javaCompiler
description "Assembles Jar contaning $project.name."
from variant.javaCompiler.destinationDir
manifest {
from sharedManifest
}
}
artifacts {
archives project.tasks.getByName("assemble${name.capitalize()}Jar")
archives project.tasks.getByName("assemble${name.capitalize()}JavadocJar")
}
}
I am stuck with this issue and don't find any solution. Can anyone help me out.
I had the same issue with another library as you have.
I could resolve that with replacing this line:
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
with:
doFirst { classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) },
"This is due to new Gradle plugin when AndroidStudio gets updated that goes in conflict with JavaDoc plugin", If you have Javadoc task you must be able to find the same line.
I develop small mvp library with included some dependency like butterknife and glide, but after it is already deployed to my private artifactory, all the dependency is not included with my library, so all the dependency is not resolved in my project when using this library. I am new with this artifactory, is I am missing something?
This is my root build.gradle :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.1"
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And this is my build.gradle module :
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: 'me.tatarka.retrolambda'
def libraryGroupId = 'com.pixilapps.pixilframework'
def libraryArtifactId = 'mvp'
def libraryVersion = '1.0.0'
publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version libraryVersion
artifactId libraryArtifactId
artifact("$buildDir/outputs/aar/${artifactId}-release.aar")
}
}
}
artifactory {
contextUrl = 'http://my.lib.web/artifactory'
publish {
repository {
repoKey = 'libs-release-local'
username = artifactory_username
password = artifactory_password
}
defaults {
publications('aar')
publishArtifacts = true
properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
publishPom = true
}
}
}
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.3.1'
}
}
repositories {
mavenCentral()
jcenter()
maven { url "https://clojars.org/repo/" }
maven { url "https://jitpack.io" }
maven {
url "https://s3.amazonaws.com/repo.commonsware.com"
}
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
minSdkVersion 17
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'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8.toString()
targetCompatibility JavaVersion.VERSION_1_8.toString()
}
}
dependencies {
final PLAY_SERVICES_VERSION = '9.6.1'
final DEXMAKER_VERSION = '1.4'
final HAMCREST_VERSION = '1.3'
final ESPRESSO_VERSION = '2.2.1'
final RUNNER_VERSION = '0.4'
final AUTO_VALUE_VERSION = '1.3'
final AUTO_VALUE_GSON_VERSION = '0.4.2'
final SUPPORT_LIBRARY_VERSION = '25.1.0'
final RETROFIT_VERSION = '2.1.0'
final BUTTERKNIFE_VERSION = '7.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION"
compile "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
compile "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION"
compile "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION"
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
compile 'com.jakewharton.timber:timber:4.1.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.vistrav:ask:2.4'
compile "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'net.danlew:android.joda:2.9.3.1'
compile 'com.pixplicity.easyprefs:library:1.7'
}
You can use pom.withXml in your publishing block, as described here (find the official documentation about pom.withXml here).
It will look like something approaching this, I guess:
publishing {
publications {
aar(MavenPublication) {
groupId libraryGroupId
version = libraryVersion
artifactId libraryArtifactId
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
pom.withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.getByName("_releaseCompile").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', it.moduleVersion)
}
}
}
}
}
I have tried to import tesseract ocr project in android studio. While building gradle it showin error as following
Error:(8, 0) Gradle DSL method not found: 'compile()'
Possible causes:The project 'textfairy' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
My app/build.gradle file
import java.util.regex.Pattern
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
import org.apache.tools.ant.taskdefs.condition.Os
task ndkBuild(type: Exec,description: 'run ndk-build') {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
workingDir 'src/main/jni'
commandLine 'ndk-build.cmd', '-j', Runtime.runtime.availableProcessors()
} else {
workingDir 'src/main/jni'
commandLine "$ndkDir/ndk-build", '-j', Runtime.runtime.availableProcessors()
}
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn(ndkBuild)
}
def getVersionCodeFromManifest(String prefix) {
def manifestFile = file("src/main/AndroidManifest.xml")
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
def manifestText = manifestFile.getText()
def matcher = pattern.matcher(manifestText)
matcher.find()
def version = prefix + matcher.group(1)
println sprintf("Returning version %s", version)
return Integer.parseInt("$version")
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
testInstrumentationRunner "android.test.InstrumentationTestRunner"
//testHandleProfiling true
//testFunctionalTest true
}
signingConfigs {
release
}
buildTypes {
debug {
debuggable true
}
release {
//runProguard true
proguardFile file('android.pro')
proguardFile getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.release
}
}
productFlavors {
x86 {
versionCode getVersionCodeFromManifest("6")
ndk {
abiFilter "x86"
}
}
aV7 {
versionCode getVersionCodeFromManifest("2")
ndk {
abiFilter "armeabi-v7a"
}
}
aV5 {
versionCode getVersionCodeFromManifest("1")
ndk {
abiFilter "armeabi"
}
}
}
sourceSets {
main {
//jniLibs.srcDirs = ['native-libs']
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] //disable automatic ndk-build
}
}
}
def Properties props = new Properties()
def propFile = new File('signing.properties')
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
} else {
println 'signing.properties found but some entries are missing'
android.buildTypes.release.signingConfig = null
}
} else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}
dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
compile fileTree(dir: 'src/main/libs', include: '*.jar')
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.github.chrisbanes.photoview:library:1.2.2'
compile 'com.google.code.findbugs:jsr305:2.0.2'
compile "com.google.guava:guava:18.0"
compile 'de.greenrobot:eventbus:2.4.0'
//compile 'com.android.support:design:22.2.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:appcompat-v7:19.0.+'
compile 'org.apache.commons:commons-compress:1.5'
compile project(":tess-two:tess-two")
compile 'com.android.support:cardview-v7:21.0.+'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.0'
androidTestCompile 'com.google.dexmaker:dexmaker:1.0'
androidTestCompile 'org.mockito:mockito-core:1.10.17'
androidTestCompile 'junit:junit:4.12'
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-all:1.10.19"
testCompile("org.robolectric:robolectric:3.0-rc2") {
exclude group: 'commons-logging', module: 'commons-logging'
}
compile('com.crashlytics.sdk.android:crashlytics:2.4.0#aar') {
transitive = true;
}
}
My project root build.gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
}
allprojects {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
maven {
url "http://oss.sonatype.org/content/repositories/snapshots"
}
}
}
dependencies {
apply plugin: 'osgi'
compile project(':libraries:tess-two')
}
My settings.gradle file
include ':libraries:tess-two'
include ':app'
My gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
I have added dependencies also. Please tell me what is the problem.
Thank you
You have to change your top-level build.gradle, removing the compile line, and adding the gradle and fabric plugin.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
maven {
url "http://oss.sonatype.org/content/repositories/snapshots"
}
}
}
Als if you want to use the libraries:tess-two in your project, you have to add this line inside the dependecies block of your app/build.gradle file
compile project(':libraries:tess-two')
Finally move the apply plugin: 'osgi' at the beginning of the app/build.gradle file
To resolve the ndk issue you have to:
add gradle.properties file to root folder of your project
add 'android.useDeprecatedNdk=true' to gradle.properties file
Here is my gradle.properties :
android.useDeprecatedNdk=true
I have an Android project using Gradle 2.2, it has 2 sub projects and one is dependent on the other. I am using Maven plugin to deploy to Artifactory and it isn't generating the correct POM.
-project
-subproject1
-subproject2 (depends on subproject1)
subproject1/build.gradle, generates a JAR:
apply plugin: 'java'
apply plugin: 'maven'
def version = '1.0.0-SNAPSHOT'
def artifactId = 'subproject1'
def groupId = 'com.xxx.yyy'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'junit:junit:4.11'
compile 'org.slf4j:slf4j-api:1.7.7'
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: 'https://my-artifactory-repo' ) {
authentication(userName: ..., password: ...)
}
snapshotRepository(url: 'https://my-artifactory-repo' ) {
authentication(userName: ..., password: ...)
}
pom.version = version
pom.artifactId = artifactId
pom.groupId = groupId
}
}
}
task installArchives(type: Upload) {
configuration = configurations['archives']
repositories {
mavenDeployer {
repository url: 'my-local-repo-path'
pom.version = version
pom.artifactId = artifactId
pom.groupId = groupId
}
}
}
The subproject1 POM is generated correctly.
subproject2/build.gradle, generates an AAR:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.slf4j:slf4j-api:1.7.7'
compile project(':subproject1')
}
The subproject2 POM is not generated correctly, for subproject1, the groupid has the same value as artifactId and version is unspecified. Anyone know how to fix this?