I am developing a app with google databinding library. But i found every time i add a new layout xml and the correspond binding class won't generate. And i have to hit the build button on android studio, then the binding class will generate.
Here is the dependencies i use
app build.grade:
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'com.fernandocejas.frodo'
android {
signingConfigs {
}
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.xinpinget.gamecube"
minSdkVersion MIN_SDK_VERSION as int
targetSdkVersion TARGET_SDK_VERSION as int
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
production {
signingConfig signingConfigs.config
}
internal {
}
}
// dexOptions {
// incremental true
// }
}
retrolambda {
jdk "/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home"
oldJdk System.getenv("JAVA_HOME")
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':insta-filter-release')
compile project(':library-debug')
compile('com.facebook.fresco:fresco:0.7.0') {
exclude module: 'support-v4'
}
provided 'com.squareup.dagger:dagger-compiler:1.2.2'
// apt ('com.squareup.dagger:dagger-compiler:1.2.2') {
// }
compile('com.android.support:design:23.0.1') {
exclude module: 'support-v4'
exclude module: 'appcompat-v7'
}
compile('io.reactivex:rxandroid:1.0.1') {
exclude module: 'rxjava'
}
compile('io.reactivex:rxjava-debug:1.0.2') {
exclude module: 'rxjava'
}
compile('com.squareup.retrofit:adapter-rxjava:2.0.0-beta2') {
exclude module: 'rxjava'
}
internalCompile 'com.squareup.retrofit:retrofit-mock:2.0.0-beta1'
internalCompile 'com.squareup.retrofit:adapter-rxjava-mock:2.0.0-beta1'
compile('com.squareup.retrofit:converter-gson:2.0.0-beta2') {
exclude module: 'retrofit'
}
compile('com.umeng:fb:5.4.0') {
/**
* If not exclude message module, gradle will throw a error when building.
*/
exclude module: 'message'
exclude module: 'support-v4'
}
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.squareup:otto:1.3.8'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.dagger:dagger:1.2.2'
compile 'io.reactivex:rxjava:1.0.14'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile project(':ShareSDK_oneKeyShare')
compile project(':sMSSDK')
compile 'com.android.support:cardview-v7:23.1.0'
}
I solved the problem.
It's caused by android-apt.
https://bitbucket.org/hvisser/android-apt/issues/38/android-apt-breaks-brand-new-data-binding
Related
I recently updated android studio to 3.0.0 same for the gradle to the corresponding version, the gradle build successfully but I cant run my project anymore here is my gradle file
enter code here
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
google()
}
apply plugin: 'realm-android'
android
{
signingConfigs {
config {
keyAlias 'XXXX'
keyPassword 'XXXX'
storeFile
file('/XXX/XXX/XXXX/XXX.jks')
storePassword 'XXX'
}
}
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "www.XXX"
minSdkVersion 23
targetSdkVersion 26
versionCode 46
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath false
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-
android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
configurations.all {
resolutionStrategy.force
'com.google.code.findbugs:jsr305:1.3.9'
all*.exclude group: 'org.apache.commons'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(':carpolo_sdk')
implementation project(':material-sheet-fab')
implementation('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}
implementation 'com.android.support:multidex:1.0.2'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.1'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services:11.4.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.jakewharton:butterknife:8.6.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.amazonaws:aws-android-sdk-core:2.3.9'
implementation 'com.amazonaws:aws-android-sdk-s3:2.3.9'
implementation 'com.amazonaws:aws-android-sdk-cognito:2.3.9'
implementation 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.3.9'
implementation 'io.saeid:fab-loading:0.6.0'
implementation 'com.google.firebase:firebase-messaging:11.4.2'
implementation 'com.google.firebase:firebase-auth:11.4.2'
implementation 'com.google.firebase:firebase-crash:11.4.2'
implementation 'com.firebaseui:firebase-ui-auth:2.0.1'
implementation 'com.google.android.gms:play-services-auth:11.4.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.github.florent37:singledateandtimepicker:1.1.0'
implementation 'com.github.apl-devs:appintro:v4.2.0'
implementation 'com.github.curioustechizen.android-ago:library:1.3.4'
implementation 'me.relex:circleindicator:1.2.2#aar'
implementation 'com.github.Mariovc:ImagePicker:1.2.0'
testCompile 'junit:junit:4.12'
implementation 'com.google.guava:guava:22.0-android'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
My swagger gradle file contains the following
enter code here
dependencies {
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile "com.google.code.gson:gson:$gson_version"
compile "org.apache.httpcomponents:httpcore:$httpcore_version"
compile "org.apache.httpcomponents:httpmime:$httpmime_version"
compile "org.apache.httpcomponents:httpclient-
android:$httpclient_version"
compile "com.android.volley:volley:${volley_version}"
testCompile "junit:junit:$junit_version"
testCompile "org.robolectric:robolectric:${robolectric_version}"
testCompile "net.jodah:concurrentunit:${concurrent_unit_version}"
}
I cant find whats wrong with my code any help would be appreciated .
Turns out libraries were mixed together since I did the update to solve that I deleted the .idea folder then I clean and rebuild the project and the error was resolved.
This is thrown when trying to open activity using context.startActivity(intent)
java.lang.TypeNotPresentException: Type android/support/v4/app/ActivityCompat$SharedElementCallback23Impl not present
All activities extends AppCompatActivity and I am calling AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) inside a static block of my application.
On newer android versions everyting is ok.
Does anybody met this issue and can share info how to solve it?
Here my gradle configuration
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
lintOptions {
disable 'RestrictedApi'
}
signingConfigs {
release {
keyAlias '****'
keyPassword '*************'
storeFile file('../release.jks')
storePassword '*************'
}
}
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "***.****"
minSdkVersion 19
targetSdkVersion 26
versionCode 8
versionName "1.0.3"
vectorDrawables.useSupportLibrary true
multiDexEnabled true
renderscriptTargetApi 26
renderscriptSupportModeEnabled true
signingConfig signingConfigs.release
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
jcenter()
}
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':googleemoji')
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude module: 'httpclient'
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.http-client:google-http-client-gson:1.22.0') {
exclude module: 'httpclient'
}
compile('com.google.apis:google-api-services-gmail:v1-rev44-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile 'com.google.firebase:firebase-auth:11.4.0'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:customtabs:26.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.google.android.gms:play-services-identity:11.4.0'
compile 'com.google.firebase:firebase-messaging:11.4.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.google.android.gms:play-services-auth:11.4.0'
compile 'com.google.android.gms:play-services-plus:11.4.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'commons-io:commons-io:2.5'
compile 'com.google.android.gms:play-services-location:11.4.0'
compile 'com.google.firebase:firebase-invites:11.4.0'
}
kotlin {
experimental {
coroutines "enable"
}
}
apply plugin: 'com.google.gms.google-services'
I have generated my signed apk for product flavors, but when i try to install the apk in my device, it says "App not installed"
Here is my gradle file code :-
android {
compileSdkVersion 25
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.app.olivesync"
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors{
main {
applicationId "com.app.olivesync"
}
resonance {
applicationId "com.app.resonance"
}
}
dependencies {
compile('com.fasterxml.jackson.core:jackson-annotations:2.2.2') {
exclude group: 'com.fasterxml.jackson.core'
}
compile('com.fasterxml.jackson.core:jackson-databind:2.2.3') {
exclude group: 'com.fasterxml.jackson.core'
}
compile('com.fasterxml.jackson.core:jackson-core:2.2.3') {
exclude group: 'com.fasterxml.jackson.core'
}
compile 'com.android.support:support-v4:25.3.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.roomorama:caldroid:3.0.1'
compile 'com.android.support:design:25.3.0'
compile 'com.google.android.gms:play-services-gcm:10.2.0'
compile 'com.microsoft.azure:notification-hubs-android-sdk:0.4#aar'
compile 'com.microsoft.azure:azure-notifications-handler:1.0.1#aar'
compile 'com.google.firebase:firebase-crash:10.2.0'
compile 'com.github.shell-software:fab:1.1.2'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.github.iammert:MaterialIntroView:1.6.0'}
repositories {
maven { url "https://jitpack.io" }
}
apply plugin: 'com.google.gms.google-services'
change your version and then try to build sign apk. Hope it will work.
I am new in android app development. I have to store a android library in bintray but I am not getting file upload option. What should I do so that I can get file upload option? my android library's build.gradle file is below
apply plugin: 'com.android.library'
apply plugin: 'realm-android'
ext {
PUBLISH_GROUP_ID = 'cyd.awesome.android'
PUBLISH_ARTIFACT_ID = 'awesome-material'
PUBLISH_VERSION = '1.0'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
minifyEnabled true // shrink
useProguard true // don't obfuscate
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
shrinkResources true
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' http://stackoverflow.com/ }
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile ('com.android.support.test:runner:0.3') {
exclude group: 'com.android.support', module: 'support annotations'
}
androidTestCompile ('com.android.support.test:rules:0.3') {
exclude group: 'com.android.support', module: 'support-annotations'
}
compile 'com.android.support:appcompat-v7:25.1.0'
//network
compile 'com.squareup.okhttp:okhttp:2.5.0'
//beacon
compile 'org.altbeacon:android-beacon-library:2.+'
//geofence
compile 'com.google.android.gms:play-services-location:10.0.1'
//firebase
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-config:10.0.1'
//parsing json
compile 'com.google.code.gson:gson:2.8.0'
//compile 'com.fasterxml.jackson.core:jackson-databind:2.5.3'
//testing
testCompile 'junit:junit:4.12'
//testCompile 'org.mockito:mockito-core:1.9.5'
//testCompile "org.robolectric:robolectric:3.0"
//reactive
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
//beacon Monitoring
//compile 'org.altbeacon:android-beacon-library:2+'
//disk storage
//compile 'com.squareup.sqlbrite:sqlbrite:1.1.1'
//compile 'com.github.satyan:sugar:1.4'
//geofire
//compile 'com.firebase:geofire-android:2.1.1'
}
apply plugin: 'com.google.gms.google-services'
apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
I write some library, which has a portion of UI. Also, this library uses another libraries.
I want to provide release .aar to use this portion of UI in any App.
My library has next dependecies:
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//Http communication, websockets, etc.
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
//Fonts
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
//Unit tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
//Other
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
//Reactive programmnig
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
When I built .aar everything is fine, but when I inlude this .aar into another app, I have next problems:
1). ./gradlew clean build
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
/home/user/projects/MainApp/app/build/intermediates/exploded-aar/com.my.sdk/SDK/0.0.1/res/values/values.xml:78:21-29
: No resource found that matches the given name: attr 'fontPath'.
:app:processDebugResources FAILED
Solution is very simple - add to MainApp/app/build.gradle next line:
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
2). When I run MainApp getting this error:
java.lang.NoClassDefFoundError: com.my.sdk.ui.fragment.DialogAppNotInstalledFragment
To solve this I need to add compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0' to MainApp/app/build.gradle.
Same to other dependecies.
In the result I need just copy-paste all my dependecies from my library project to MainApp project.
Is it possible to make library aar contain all necessery dependecies?
build.gradle of library:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
//apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
repositories {
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "0.0.1"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
dexOptions {
preDexLibraries = false
incremental true
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.readme'
}
lintOptions {
abortOnError false
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//Http communication, websockets, etc.
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
//Fonts
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
//Unit tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
//Other
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
//Reactive programmnig
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
}
// To publish to maven local execute "gradle clean build publishToMavenLocal"
// To publish to nexus execute "gradle clean build publish"
android.libraryVariants
publishing {
publications {
maven(MavenPublication) {
artifact "${project.buildDir}/outputs/aar/${project.name}-release.aar"
artifactId = POM_ARTIFACT_ID
groupId = GROUP
version = VERSION_NAME
// Task androidSourcesJar is provided by gradle-mvn-push.gradle
//artifact androidSourcesJar {
// classifier "sources"
//}
}
}
repositories {
maven {
credentials {
username System.getenv('NEXUS_USER_NAME')
password System.getenv('NEXUS_PASSWORD')
}
url "http://my-nexus-url/"
}
}
}
MainApp/app/build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://my-nexus-url/' }
flatDir {
dirs 'libs'
}
}
android {
signingConfigs {
some_config {
keyAlias 'some alias'
keyPassword '741789654uppy'
storeFile file('../my-keystore.jks')
storePassword 'some_password'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.company.app.android"
minSdkVersion 14
targetSdkVersion 23
versionCode 9
versionName "1.0.0"
}
dexOptions {
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.some_config
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile files('libs/StartAppInApp-2.3.1.jar')
// compile files('libs/android-support-v4.jar')
compile files('libs/applovin-sdk-5.2.0.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
//here is my library!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
compile('com.my.sdk:SDK:0.0.1#aar'){
transitive = true;
exclude(group:'android.support', module: 'support-v4')
}
//***********************************************
//Dependecies from library
//***********************************************
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile 'com.android.support:appcompat-v7:23.1.1'
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//************************************************
}
UPDATE
Generated POM file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.my.sdk</groupId>
<artifactId>SDK</artifactId>
<version>0.0.1</version>
<packaging>aar</packaging>
</project>
If anybody have the same problem, you may obtain correct answer here
Result build.gradle is:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
repositories {
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "0.0.1"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
dexOptions {
preDexLibraries = false
incremental true
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.readme'
}
lintOptions {
abortOnError false
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile ('com.android.support:recyclerview-v7:22.2.1'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.10.0'
//Http communication, websockets, etc.
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
//Fonts
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
//Unit tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
//Other
compile ('org.apache.commons:commons-lang3:3.4'){
exclude group: 'org.apache.httpcomponents'
}
//Reactive programmnig
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
}
// To publish to maven local execute "gradle clean build publishToMavenLocal"
// To publish to nexus execute "gradle clean build publish"
android.libraryVariants
publishing {
publications {
maven(MavenPublication) {
artifact "${project.buildDir}/outputs/aar/${project.name}-release.aar"
artifactId = POM_ARTIFACT_ID
groupId = GROUP
version = VERSION_NAME
pom.withXml {
def depsNode = asNode().appendNode('dependencies')
configurations.compile.allDependencies.each { dep ->
if(dep.name != null && dep.group != null && dep.version != null) {
def depNode = depsNode.appendNode('dependency')
depNode.appendNode('groupId', dep.group)
depNode.appendNode('artifactId', dep.name)
depNode.appendNode('version', dep.version)
//optional add scope
//optional add transitive exclusions
}
}
}
}
}
repositories {
maven {
credentials {
username System.getenv('NEXUS_USER_NAME')
password System.getenv('NEXUS_PASSWORD')
}
url "http://nexus-repository-url/"
}
}
}