I've successfully converted an Eclipse Workspace to be usable in Android Studio by using the gradle scripts in Eclipse and deploying everything into a local artifactory repository.
My problem is that I used to go with the Eclipse build-chain when developing and debugging and the gradle toolchain when releasing. AndroidStudio (v.1.3.2) did a good job analysing the gradle scripts and I'm able to start the App from the Workbench.
There is one bigger library that imports all of the dependencies and an app stub that uses that library. I currently have two Android Studio instances open with one for each project, tried to import the library as a module but this copied all the source into the app stub folder.
How can I accomplish to develop the library project in Android Studio without having to release it via 'uploadArchives' and adjusting the library version in both projects all the time?
Thanks for your help.
Below is the gradle script to illustrate the situation:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
buildscript {
repositories {
maven {
//url 'http://debian:8081/artifactory/repo'
url 'http://debian:8081/artifactory/plugins-release'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:2.2.3'
}
}
plugins {
id 'com.jfrog.artifactory' version '3.0.1'
}
allprojects {
}
version=theVersion
apply plugin: 'maven'
apply plugin: 'android'
repositories {
mavenCentral()
maven {
url 'http://debian:8081/artifactory/libs-release'
}
}
android {
buildToolsVersion "${android_buildToolsVersion}"
compileSdkVersion 22
signingConfigs {
release {
def storePass = "";// new String(System.console().readPassword("\n\$ Enter keystore password: "))
storeFile file(theKeystorePath)
storePassword storePass
keyAlias theKeyAlias
keyPassword storePass
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
buildTypes {
release {
minifyEnabled true
proguardFile 'proguard-project.txt'
//getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.release
}
}
//http://stackoverflow.com/questions/20989317/multiple-dex-files-define-landroid-support-v4-accessibilityservice-accessibility
dexOptions {
preDexLibraries = false
}
lintOptions {
abortOnError false
}
}
dependencies {
compile 'com.android.support:support-v4:22.0.+'
compile 'com.mydomain.common:commonbilling-lib:1.0.1@aar'
compile ('com.mydomain.mylibrary:mylibrary-lib:2.8.3@aar') {
transitive=true
exclude module: 'support-v4'
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
resolve {
repository {
repoKey = 'libs-release'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
//http://6by9.wordpress.com/2011/09/01/groovy-with-gradle-and-artifactory/
uploadArchives {
doFirst {
assert version && version != 'unspecified', "Version not specified. Specify as:\n\tgradle -Pversion=1.0 [task]\n"
}
uploadDescriptor = true
}