Our android build started failing all on its own without a single line change for 2 days now.
This is the error message:
/Users/shroukkhan/.gradle/caches/transforms-1/files-1.1/ui-5.11.1.aar/baa8b66e2e52a0a50719f014fc3f1c32/res/values/values.xml:40:5-54: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/shroukkhan/.gradle/caches/transforms-1/files-1.1/ui-5.11.1.aar/baa8b66e2e52a0a50719f014fc3f1c32/res/values/values.xml:40:5-54: AAPT: error: resource android:attr/ttcIndex not found.
As I understand this is related to android support library version mismatch, so i have forced using same library version . However, the problem has persisted. Here is the root level build.gradle:
buildscript {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://plugins.gradle.org/m2/' }
maven { url "https://maven.google.com" } // Google's Maven repository
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'hu.supercluster:paperwork-plugin:1.2.7'
classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.5.0"
}
}
allprojects {
repositories {
google()
maven { url 'https://jitpack.io' }
maven { url 'https://plugins.gradle.org/m2/' }
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url "https://maven.google.com"
}
flatDir {
dirs 'libs'
}
configurations.all {
resolutionStrategy {
// force certain versions of dependencies (including transitive)
force 'com.squareup.okhttp3:okhttp:3.4.1'
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
details.useVersion "0.38.0"
}
}
}
}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
task dependencyReportFile(type: DependencyReportTask) {
outputFile = file('dependencies.txt')
}
ext {
supportLibVersion = "27.1.0"
googlePlayServicesVersion = "15.0.1"
googlePlayServicesAnalyticsVersion = "16.0.4"
envConfigFiles = [
develop: ".env.develop",
production: ".env.production",
staging: ".env.staging",
anycustombuildlowercase: ".env",
]
}
subprojects {
if (project.name.contains('react-native-facebook-login') || project.name.contains('react-native-image-picker') ||
project.name.contains('react-native-permissions') || project.name.contains('react-native-vector-icons') ) {
buildscript {
repositories {
jcenter()
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
supportLibVersion = "27.1.0"
googlePlayServicesVersion = "15.0.1" //<-- life save line?
}
}
}
}
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
supportLibVersion = "27.1.0"
googlePlayServicesVersion = "15.0.1"
}
android {
lintOptions {
tasks.lint.enabled = false
}
}
}
}
}
allprojects {
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
details.useVersion "0.38.0" // Your real React Native version here
}
}
}
resolutionStrategy.force 'com.android.support:support-v4:27.1.0'
}
}
And here is the app level build.gradle:
buildscript {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://plugins.gradle.org/m2/' }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "io.realm:realm-gradle-plugin:2.3.1"
classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.5.0"
}
}
apply plugin: "com.android.application"
apply plugin: 'hu.supercluster.paperwork'
paperwork {
set = [
OKKAMI_APP_VERSION: "2.0",
buildTime : buildTime("yyyy-MM-dd HH:mm:ss", "GMT"),
gitSha : gitSha(),
gitTag : gitTag(),
gitInfo : gitInfo(),
gitBranch : gitBranch()
]
}
import com.android.build.OutputFile
project.ext.envConfigFiles = [
debug : ".env.develop",
release : ".env.production",
staging : ".env.staging",
sixsensesDevelop : ".evn.sixsenses.develop",
sixsensesProduction : ".env.sixsenses.production",
cirqProduction : ".env.cirq.production",
nextDevelop : ".env.next.develolp",
nextProduction : ".env.next.production",
anycustombuildlowercase: ".env.develop",
]
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
buildToolsVersion = '27.0.3'
lintOptions {
abortOnError false
}
def versionPropsFile = file('../../build')
def versionBuild
def paperworkfile = file('src/main/assets/paperwork.json')
if (versionPropsFile.canRead()) {
FileInputStream fin = new FileInputStream(versionPropsFile);
BufferedReader reader = new BufferedReader(new InputStreamReader(fin));
String ret = reader.readLine();
fin.close();
versionBuild = ret.split("\n")[0];
} else {
throw new GradleException("Could not read build file")
}
ext.autoIncrementBuildNumber = {
if (versionPropsFile.canRead()) {
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
versionBuild = versionProps['VERSION_BUILD'].toInteger() + 1
versionProps['VERSION_BUILD'] = versionBuild.toString()
versionProps.store(versionPropsFile.newWriter(), null)
} else {
throw new GradleException("Could not read version.properties!")
}
}
def props = new Properties()
def configFile
def prefix = "OKKAMI"
defaultConfig {
applicationId "com.okkami.android.app"
buildToolsVersion "28.0.3"
compileSdkVersion 28
ndk {
abiFilters "armeabi-v7a", "x86"
}
multiDexEnabled true
manifestPlaceholders = [devUrlCustomScheme: "okkamidevelop", stagingUrlCustomScheme: "okkamistaging", prodUrlCustomScheme: "okkami"]
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
resValue "string", "build_config_package", "com.okkami.android.app"
javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
dexOptions {
javaMaxHeapSize "8g" //specify the heap size for the dex process
}
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
debug { //sign debug apk as well...
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/maven/pom.properties'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/gson/FieldAttributes.class'
exclude '.readme'
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
debug {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
flavorDimensions "default"
productFlavors {
// OKKAMI
develop {
applicationId "com.okkami.android.app.dev"
versionCode = versionBuild.toInteger()
versionName = '2.0.' + versionBuild
}
staging {
applicationId "com.okkami.android.app.staging"
versionCode = versionBuild.toInteger()
versionName = '2.1.' + versionBuild
}
production {
applicationId "com.okkami.android.app"
versionCode = versionBuild.toInteger()
versionName = '2.2.' + versionBuild
}
// Six Senses
sixsensesDevelop {
applicationId "com.okkami.android.sixsenses.app.dev"
versionCode = versionBuild.toInteger()
versionName = '2.0.' + versionBuild
}
// sixsensesStaging {
// applicationId "com.okkami.android.sixsenses.app.staging"
// versionCode = versionBuild.toInteger()
// versionName = '2.1.' + versionBuild
// }
//
sixsensesProduction {
applicationId "com.okkami.android.sixsenses.app"
versionCode = versionBuild.toInteger()
versionName = '2.2.' + versionBuild
}
// Cirq
cirqDevelop {
applicationId "com.cirq.android.app.dev"
versionCode = versionBuild.toInteger()
versionName = '2.0.' + versionBuild
}
cirqProduction {
applicationId "com.cirq.android.app"
versionCode = versionBuild.toInteger()
versionName = '2.2.' + versionBuild
}
// Next
nextDevelop {
applicationId "com.okkami.android.next.app.dev"
versionCode = versionBuild.toInteger()
versionName = '2.0.' + versionBuild
}
nextProduction {
applicationId "com.okkami.android.next.app"
versionCode = versionBuild.toInteger()
versionName = '2.2.' + versionBuild
}
}
compileSdkVersion = 27
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
def supportLibraryVersion = "27.1.0"
def firebaseMessagingVersion = "17.3.2"
dependencies {
compile(project(':react-native-camera')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
compile project(':react-native-device-brightness')
implementation project(':react-native-battery')
implementation project(':react-native-fast-image')
implementation project(':react-native-bluetooth-status')
implementation project(':react-native-fetch-blob')
compile 'com.github.nisrulz:easydeviceinfo-base:2.4.0'
implementation(project(':react-native-audio-streaming'))
{
exclude module: 'support-v4'
}
implementation project(':react-native-restart')
implementation project(':react-native-wheel-picker')
implementation project(':react-native-tcp')
implementation project(':react-native-exit-app')
implementation project(':react-native-aws-cognito-js')
implementation project(':react-native-svg')
implementation project(':react-native-fs')
implementation project(':react-native-google-analytics-bridge')
implementation project(':react-native-fbsdk')
implementation project(':react-native-blur')
implementation project(':react-native-geocoder')
implementation project(':react-native-facebook-login')
implementation project(':react-native-vector-icons')
implementation(project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
implementation project(':react-native-i18n')
implementation project(':react-native-config')
implementation project(':okkami-sdk')
implementation project(':react-native-permissions')
implementation project(':okkami-react-sdk')
// Line SDK
compile(name: 'line-sdk-4.0.0', ext: 'aar')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:customtabs:${supportLibraryVersion}"
compile('io.smooch:core:5.11.1') {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
compile('io.smooch:ui:5.11.1') {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
exclude group: 'com.android.support', module: 'support-v4'
}
// compile 'io.smooch:core:5.14.2'
// compile 'io.smooch:ui:5.14.2'
// Libraries imported by Smooch
implementation "com.google.firebase:firebase-core:16.0.3"
implementation "com.google.firebase:firebase-messaging:${firebaseMessagingVersion}"
implementation "com.android.support:exifinterface:${supportLibraryVersion}"
implementation "com.android.support:recyclerview-v7:${supportLibraryVersion}"
implementation "com.android.support:support-media-compat:${supportLibraryVersion}"
implementation "com.google.android.gms:play-services-location:16.0.0"
compileOnly 'org.projectlombok:lombok:1.16.20'
annotationProcessor 'org.projectlombok:lombok:1.16.20'
implementation "com.google.firebase:firebase-auth:16.0.3"
implementation "com.google.firebase:firebase-firestore:17.1.0"
implementation "com.google.firebase:firebase-analytics:16.0.3"
implementation 'com.google.android.gms:play-services-analytics:16.0.3'
compile 'com.pusher:push-notifications-android:1.0.1'
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.facebook.react:react-native:0.20.1'
compile 'com.facebook.android:facebook-android-sdk:4.37.0'
compile 'net.hockeyapp.android:HockeySDK:4.1.3'
compile 'com.android.support:support-core-utils:27.1.0'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:support-v13:27.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'hu.supercluster:paperwork:1.2.7'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.shiraji:butai-java:1.0.2'
compile 'com.android.support:support-v4:27.1.0'
// Lombo
// implementation 'org.projectlombok:lombok:1.16.16'
// HockeyApp
compile 'net.hockeyapp.android:HockeySDK:5.1.1'
// Google Analytics
implementation(project(':react-native-google-analytics-bridge')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
// Badges for Android
compile 'me.leolin:ShortcutBadger:1.1.16#aar'
compile files('libs/AndroidRuntimePermissions.jar')
// Webview for Android
implementation project(':RNWebView')
//compile project(':react-native-mauron85-background-geolocation')
implementation project(':react-native-smart-splashscreen')
implementation project(':openkeysdk-release')
/*guava library used for salto*/
implementation('com.google.guava:guava:18.0') {
exclude module: 'support-v4'
}
//slf4j,bouncycastle and mixpanel used for assa
implementation 'org.slf4j:slf4j-api:1.7.25'
implementation 'org.slf4j:slf4j-android:1.7.21'
implementation 'org.bouncycastle:bcprov-jdk15on:1.58'
implementation('com.mixpanel.android:mixpanel-android:4.+') {
exclude module: 'support-v4'
}
//OKC
implementation 'com.clj.fastble:FastBleLib:2.3.4'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
compile project(path: ':react-native-linear-gradient')
compile project(path: ':RNMaterialKit')
compile project(path: ':react-native-image-picker')
implementation(project(path: ':react-native-device-info')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
compile project(':react-native-orientation')
compile project(':react-native-full-screen')
implementation(project(':react-native-play-sound')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
implementation "com.android.support:support-core-utils:27.1.0"
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
configurations.all {
resolutionStrategy.force "com.google.android.gms:play-services-base:15.0.1"
resolutionStrategy.force "com.google.android.gms:play-services-tasks:15.0.1"
resolutionStrategy.force "com.google.android.gms:play-services-stats:15.0.1"
resolutionStrategy.force "com.google.android.gms:play-services-basement:15.0.1"
resolutionStrategy.force "com.android.support:appcompat-v7:27.1.0"
resolutionStrategy.force 'com.android.support:support-v4:27.1.0'
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
task dependencyReportFile(type: DependencyReportTask) {
outputFile = file('dependencies.txt')
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
I have tracked it down to most likely candidate : io.smooch:ui:5.11.1 ( because the error states : .gradle/caches/transforms-1/files-1.1/ui-5.11.1.aar/baa8b66e2e52a0a50719f014fc3f1c32/res/values/values.xml:40:5-54: AAPT: error: resource android:attr/fontVariationSettings not found. ) . However, no solution proposed online has been working.
Does anyone have any idea whats going on ?
Edit : link to excerpt from dependency tree: https://pastebin.com/raw/YNHWkf5D
The fontVariationSettings attribute was added in API Level 28.
Set your compileSdkVersion to 28 or higher to be able to use libraries that reference this attribute.
Update your fb dependency version-
implementation 'com.facebook.android:facebook-android-sdk:5.11.0'
and you have to add following line to android/gradle.properties:
facebookSdkVersion=5.11.0
Change :
implementation 'com.facebook.android:facebook-android-sdk:5.11.1'
TO:
implementation 'com.facebook.android:facebook-android-sdk:5.11.0'
Located in app.gradle file
Clean project and Rebuild
Happy Coding!
Related
I'm trying to run my project with `.\gradlew assembleDenug' but I keep getting this output
Could not resolve all files for configuration ':app:mobileGoogleZappDebugCompileClasspath'.
> Could not resolve com.applicaster:GrandeFamily:0.3.+.
Required by:
project :app
> Failed to list versions for com.applicaster:GrandeFamily.
> Unable to load Maven meta-data from https://dl.bintray.com/applicaster-ltd/maven/com/applicaster/GrandeFamily/maven-metadata.xml.
> Could not get resource 'https://dl.bintray.com/applicaster-ltd/maven/com/applicaster/GrandeFamily/maven-metadata.xml'.
> java.lang.NullPointerException (no error message)
I looked for answers online but most of them just said to change the order of google(), maven() and jcenter(), but it didn't help.
This is my project level gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.0'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
maven {
credentials{
username System.getenv("MAVEN_USERNAME")
password System.getenv("MAVEN_PASSWORD")
}
url 'https://dl.bintray.com/applicaster-ltd/maven'
}
maven {
url "$rootDir/node_modules/react-native/android"
}
maven {
url "$rootDir/.m2"
}
maven {
url "https://dl.bintray.com/applicaster-ltd/maven_plugins"
}
maven {
url "https://mvn.jwplayer.com/content/repositories/releases/"
}
maven {
url "https://dl.bintray.com/applicaster-ltd/maven_plugins/"
}
maven { url 'https://github.com/applicaster/APLiveScreenPro7-RN.git' }
}
}
/**
* Auto-generated from .env build configuration.
*/
ext.dimensionsConfig = [
"platform": "mobile", // ["google", "amazon"]
"vendor": "google", // ["mobile", "tv"]
"flavor": "zapp", // ["zapp", "quickbrick"]
]
/**
* Order of dimensions is critical! platform > vendor > flavor
*/
ext.zappProductFlavors = [
mobile: "platform",
tv: "platform",
google: "vendor",
amazon: "vendor",
zapp: "flavor",
quickbrick: "flavor",
]
ext.zappProductFlavorsMap = {
zappProductFlavors.each { key, dim ->
"${key}" { dimension "${dim}" }
}
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
flavorDimensions dimensionsConfig.keySet() as String[]
productFlavors zappProductFlavorsMap
}
/**
* Reject all variants that are not relevant for the current build -
* you should be left with two only, debug and release.
* e.g.: "mobileGoogleZappDebug/Release" or "tvAmazonZappDebug/Release" etc.
*/
android.variantFilter { variant ->
for (flavor in variant.getFlavors()) {
if (flavor.name != dimensionsConfig[flavor.dimension]) {
variant.setIgnore(true)
}
}
}
}
}
}
This is my app level gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.protvromania"
minSdkVersion 19
targetSdkVersion 28
versionCode 273
versionName "1.0.4-alpha.3"
manifestPlaceholders = [
app_name: "PROTV",
fb_app_id: "1147926948637494",
]
multiDexEnabled true
renderscriptSupportModeEnabled true
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
dexOptions {
jumboMode = true
preDexLibraries = false
javaMaxHeapSize "4g"
}
packagingOptions {
// Common
pickFirst 'META-INF/NOTICE.txt'
pickFirst 'META-INF/LICENSE.txt'
pickFirst 'META-INF/LICENSE'
pickFirst 'META-INF/ASL2.0'
pickFirst 'META-INF/NOTICE'
pickFirst 'META-INF/MANIFEST.MF'
// https://github.com/ReactiveX/RxJava/issues/4445
pickFirst 'META-INF/rxjava.properties'
// This IMA hack is resolved with gradle wrapper version 2.3.3 - it's kept here for backward compatability - can be removed after a while.
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
}
signingConfigs {
release {
storeFile file("../dist.keystore")
storePassword ""
keyAlias ""
keyPassword ""
}
}
buildTypes {
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
/**
* See top-level build.gradle for:
* - Dimension configuration of the specific build
* - All product flavors mapping
*/
flavorDimensions dimensionsConfig.keySet() as String[]
productFlavors zappProductFlavorsMap
}
/*
* Create alias for the generated mobile flavors combination,
* to keep backward compatibility without modifying CircleCI code.
* e.g.: "apk/mobile/app-mobile-debug.apk" will actually point to "apk/mobileGoogleZapp/debug/app-mobile-google-zapp-debug.apk"
*/
ext.createMobileShortcut = { runtimeBuildType ->
if (dimensionsConfig.platform == 'mobile') {
def vendor = dimensionsConfig.vendor
def flavor = dimensionsConfig.flavor
def mobilePath = "app/build/outputs/apk/mobile/" + runtimeBuildType
def apkPath = mobilePath + "/app-mobile-" + runtimeBuildType + ".apk"
def compatibilityApkPath = "app/build/outputs/apk/app-mobile-" + runtimeBuildType + ".apk"
def mobileApk = new File(apkPath)
if (!mobileApk.exists()) {
new File(mobilePath).mkdirs()
def baseDirectory = System.getProperty("user.dir")
def existingApkPath = baseDirectory + '/app/build/outputs/apk/mobile' + vendor.capitalize() + flavor.capitalize() + '/' + runtimeBuildType + '/app-mobile-' + vendor + '-' + flavor + '-' + runtimeBuildType + '.apk'
['ln', '-s', existingApkPath, apkPath].execute().waitFor()
['ln', '-s', existingApkPath, compatibilityApkPath].execute().waitFor()
new File("app/build/outputs/mapping/mobile/" + runtimeBuildType).mkdirs()
['ln', '-s', baseDirectory + '/app/build/outputs/mapping/mobile' + vendor.capitalize() + flavor.capitalize() + '/' + runtimeBuildType + '/mapping.txt', 'app/build/outputs/mapping/mobile/' + runtimeBuildType + '/mapping.txt'].execute().waitFor()
}
}
}
/**
* Create alias for the generated tv flavors combination, see example in createMobileShortcut
*/
ext.createTvShortcut = { runtimeBuildType ->
if (dimensionsConfig.platform == 'tv') {
def vendor = dimensionsConfig.vendor
def flavor = dimensionsConfig.flavor
def tvPath = "app/build/outputs/apk/tv/" + runtimeBuildType
def apkPath = tvPath + "/app-tv-" + runtimeBuildType + ".apk"
def tvApk = new File(apkPath)
if (!tvApk.exists()) {
new File(tvPath).mkdirs()
['ln', '-s', System.getProperty("user.dir") + '/app/build/outputs/apk/tv' + vendor.capitalize() + flavor.capitalize() + '/' + runtimeBuildType + '/app-tv-' + vendor + '-' + flavor + '-' + runtimeBuildType + '.apk', apkPath].execute().waitFor()
new File("app/build/outputs/mapping/tv/" + runtimeBuildType).mkdirs()
['ln', '-s', System.getProperty("user.dir") + '/app/build/outputs/mapping/tv' + vendor.capitalize() + flavor.capitalize() + '/' + runtimeBuildType + '/mapping.txt', 'app/build/outputs/mapping/tv/' + runtimeBuildType + '/mapping.txt'].execute().waitFor()
}
}
}
ext.dimensionedBuildTaskName = { suffix ->
def capitalizedDimensions = dimensionsConfig.inject([]) { r, v -> r << v.value.capitalize() }.join("")
'assemble' + capitalizedDimensions + suffix.capitalize()
}
/**
* Helper closure for creating paths - no more slash bugs
*/
ext.combinePaths = { paths ->
if (paths in String) paths = [paths] // be nice and return a proper path also with a single String
def file = new File("")
paths.each { path ->
file = new File(file.getPath(), path)
}
file.getPath()
}
task assembleMobileDebug() {
dependsOn dimensionedBuildTaskName('debug')
doLast {
createMobileShortcut('debug')
}
}
task assembleMobileRelease() {
dependsOn dimensionedBuildTaskName('release')
doLast {
createMobileShortcut('release')
}
}
task assembleTvDebug() {
dependsOn dimensionedBuildTaskName('debug')
doLast {
createTvShortcut('debug')
}
}
task assembleTvRelease() {
dependsOn dimensionedBuildTaskName('release')
doLast {
createTvShortcut('release')
}
}
if (System.getenv("CIRCLECI")) {
android.signingConfigs.debug.storeFile = file("../debug.keystore")
}
dependencies {
implementation ("com.applicaster:JWPlayerPlugin:1.5.+") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:GrandeFamily:0.3.+") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:ChagresFamily:0.3.2") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:LermaFamily:0.3.+") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:RhineFamily:0.4.4") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:BottomTabBarMenu-Android:5.1.0") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:FirebaseAnalyticsPlugin:2.3.0") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:DanubeFamily:0.4.+") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:DFP-Plugin:0.3.+") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:GoogleAnalyticsProvider:3.1.0") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:protv-login-plugin:0.2.+") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:ColoradoFamily:0.4.0") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:ElbeFamily:0.9.+") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
implementation ("com.applicaster:urbanAirship-Android:2.0.0") {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
exclude group: 'com.applicaster', module: 'zapp-root-android'
}
api 'com.applicaster:applicaster-modular-sdk:100.0.0'
implementation (project(':react-native-linear-gradient')) {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
}
implementation (project(':react-native-svg')) {
exclude group: 'com.applicaster', module: 'applicaster-android-sdk'
}
}
apply plugin: 'com.google.android.gms.strict-version-matcher-plugin'
I'm completely lost and have no idea what can be causing this error
Try enabling Embedded Maven repository. Go to File>setting>build>Gradle>Android studio... Check "Enable embedded maven repository"
I downloaded this sample speech-to-text project:
https://github.com/GoogleCloudPlatform/android-docs-samples/tree/master/speech
The project is working fine. However, I want to add the text-to-speech functionality. Whenever I try to compile com.google.cloud:google-cloud-texttospeech:0.70.0-beta I get the following error and the project crashes:
Multiple dex files define Lcom/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream;
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Here's my app's build.gradle:
apply plugin: 'com.google.protobuf'
apply plugin: 'com.android.application'
ext {
supportLibraryVersion = '25.4.0'
grpcVersion = '1.4.0'
}
android {
compileSdkVersion 25
flavorDimensions "default"
defaultConfig {
applicationId "com.google.cloud.android.speech"
targetSdkVersion 25
versionCode 1
versionName '1.0'
multiDexEnabled true
}
signingConfigs {
release {
storeFile file(project.properties.storeFile)
storePassword project.properties.storePassword
keyAlias project.properties.keyAlias
keyPassword project.properties.keyPassword
}
}
productFlavors {
dev {
dimension "default"
// Minimum version with platform multi-dex support
minSdkVersion 21
}
prod {
dimension "default"
// Minimum version that can run gRPC (TLS extension)
minSdkVersion 16
}
}
buildTypes {
debug {
minifyEnabled false
multiDexEnabled true
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.2'
resolutionStrategy.force "com.android.support:support-annotations:$supportLibraryVersion"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/INDEX.LIST'
}
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.3.0'
}
plugins {
javalite {
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
}
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
javalite {}
grpc {
// Options added to --grpc_out
option 'lite'
}
}
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// UI-related libraries
implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
// Support libraries
implementation "com.android.support:design:$supportLibraryVersion"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
// gRPC
implementation "io.grpc:grpc-okhttp:$grpcVersion"
implementation "io.grpc:grpc-protobuf-lite:$grpcVersion"
implementation "io.grpc:grpc-stub:$grpcVersion"
implementation 'javax.annotation:javax.annotation-api:1.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
protobuf 'com.google.protobuf:protobuf-java:3.6.1'
// OAuth2 for Google API
implementation('com.google.auth:google-auth-library-oauth2-http:0.7.0') {
exclude module: 'httpclient'
}
// Tests
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
implementation ('com.google.cloud:google-cloud-texttospeech:0.70.0-beta'){
exclude module: 'httpclient'
}
compile 'com.android.support:multidex:1.0.3'
}
task copySecretKey(type: Copy) {
def File secretKey = file "$System.env.GOOGLE_APPLICATION_CREDENTIALS"
from secretKey.getParent()
include secretKey.getName()
into 'src/main/res/raw'
rename secretKey.getName(), "credential.json"
}
preBuild.dependsOn(copySecretKey)
In my CI pipeline until June 6 it worked. Today it failed. The following build error occurred.
WARNING: Module 'com.android.support:support-vector-drawable:26.0.2' depends on one or more Android Libraries but is a jar
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not find support-vector-drawable.jar (com.android.support:support-
vector-drawable:26.0.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-vector-
drawable/26.0.2/support-vector-drawable-26.0.2.jar
Build.Gradle file
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "io.realm:realm-gradle-plugin:3.1.4"
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.newrelic.agent.android:agent-gradle-plugin:5.+'
classpath 'com.google.gms:google-services:3.1.0'
classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://mobile-sdk.jumio.com' }
maven {
url "https://maven.google.com/" // Google's Maven repository
}
maven {
url "http://kochava.bintray.com/maven"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App level
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'newrelic'
apply plugin: "io.spring.dependency-management"
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
defaultConfig {
applicationId "com.seven.eleven.phoenix"
minSdkVersion 19
targetSdkVersion 26
versionCode 16
versionName "1.1.1_1_QA"
multiDexEnabled true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
renderscriptTargetApi 21
renderscriptSupportModeEnabled true
}
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
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'
}
sourceSets { main { assets.srcDirs = ['src/main/assets',
'src/main/assets/fonts'] } }
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
buildTypes.each {
it.buildConfigField 'String', 'STRIPE_APIKEY',
keystoreProperties['StripeKey']
it.buildConfigField 'String', 'PHOENIX_API_KEY',
keystoreProperties['PhoenixAPIKey']
it.buildConfigField 'String', 'NEW_RELIC_KEY',
keystoreProperties['NewRelicKey']
it.buildConfigField 'String', 'OPEN_WEATHER_API_KEY',
keystoreProperties['OpenWeatherAPIKey']
it.buildConfigField 'int', 'WORKING_BRANCH', getCurrentGitBranch()
}
}
def getCurrentGitBranch() {
def gitBranch = "Unknown branch"
try {
def workingDir = new File("${project.projectDir}")
def result = 'git rev-parse --abbrev-ref HEAD'.execute(null, workingDir)
result.waitFor()
if (result.exitValue() == 0) {
gitBranch = result.text.trim()
}
} catch (e) {
}
if(gitBranch.contains('master')||gitBranch.contains('PROD') ||
gitBranch.contains('7XXX_Master')){
return "1";
} else {
return "0";
}
}
ext {
SDK_VERSION = "2.10.0"
ANDROID_VERSION = "26.0.2"
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.1',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.squareup.retrofit2:retrofit:2.3.0')
{
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
compile('com.squareup.retrofit2:converter-gson:2.3.0')
{
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
compile group: 'de.mindpipe.android', name: 'android-logging-log4j',
version: '1.0.3'
compile group: 'log4j', name: 'log4j', version: '1.2.17'
compile "com.android.support:cardview-v7:${ANDROID_VERSION}#aar"
compile "com.android.support:mediarouter-v7:${ANDROID_VERSION}#aar"
compile "com.android.support:palette-v7:${ANDROID_VERSION}#aar"
compile "com.android.support:design:${ANDROID_VERSION}#aar"
compile "com.android.support:appcompat-v7:${ANDROID_VERSION}#aar"
compile "com.jumio.android:core:${SDK_VERSION}#aar"
compile "com.jumio.android:bam:${SDK_VERSION}#aar"
compile "com.jumio.android:nv:${SDK_VERSION}#aar"
compile "com.jumio.android:nv-mrz:${SDK_VERSION}#aar"
compile "com.jumio.android:nv-barcode:${SDK_VERSION}#aar"
compile "com.jumio.android:nv-barcode-vision:${SDK_VERSION}#aar"
compile "com.jumio.android:nv-liveness:${SDK_VERSION}#aar"
compile "com.jumio.android:dv:${SDK_VERSION}#aar"
compile group: 'log4j', name: 'log4j', version: '1.2.17'
compile group: 'com.googlecode.libphonenumber', name: 'libphonenumber',
version: '7.0'
compile('com.squareup.retrofit2:converter-simplexml:2.3.0') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
compile('org.simpleframework:simple-xml:2.7.1') {
exclude group: 'stax', module: 'stax-api'
compile('org.simpleframework:simple-xml:2.7.1') {
exclude group: 'stax', module: 'stax-api'
exclude group: 'xpp3', module: 'xpp3'
}
compile files('libs/simple-xml-2.7.1.jar')
compile 'com.android.support.constraint:constraint-layout:1.0.1'
compile 'com.jakewharton:butterknife:8.8.1'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.9.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.kochava.base:tracker:3.2.0'
compile 'com.newrelic.agent.android:android-agent:5.+'
compile 'com.stripe:stripe-android:6.0.0'
testCompile 'junit:junit:4.12'
compile 'com.google.dagger:dagger:2.9'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
provided 'javax.annotation:jsr250-api:1.0'
//for pay with google using google wallet service
compile 'com.google.android.gms:play-services-wallet:11.6.0'
compile 'com.google.android.gms:play-services:11.6.0'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
compile 'org.jsoup:jsoup:1.11.2'
compile
compile('com.amazonaws:aws-android-sdk-kms:2.6+') { transitive = true; }
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile "org.robolectric:robolectric:3.6.1"
}
dependencyManagement {
imports {
mavenBom 'com.amazonaws:aws-java-sdk-bom:1.11.257'
}
}
apply plugin: 'com.google.gms.google-services'
I have included the build gradle file as well as app level project configuration It was unable to download that dependency.Any help would be greatly appreciated.we are using an gradle 4.1 and a docker container to make the build. I used command ./gradle clean initially.
I have this error:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/android/gms/iid/zzb$zza$zza.class
When I use
compile 'com.google.android.gms:play-services-maps:9.4.0'
With compile 'com.google.android.gms:play-services-maps:8.4.0' everything is ok.
Right now is syncing ok, but when I try to run the project I got this error.
This is my complete build.gradle:
buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
maven {
url releasesRepoUrl
credentials {
username releasesRepoUsername
password releasesRepoPassword
}
}
maven {
url snapshotsRepoUrl
credentials {
username snapshotsRepoUsername
password snapshotsRepoPassword
}
}
maven {
url thirdPartyRepoUrl
credentials {
username thirdPartyRepoUsername
password thirdPartyRepoPassword
}
}
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
classpath 'com.xxx:android-variantSelector-gradle-plugin:1.0'
classpath 'org.robolectric:robolectric-gradle-plugin:1.1.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'org.robolectric'
apply plugin: 'crashlytics'
apply plugin: 'sonar-runner'
apply plugin: 'com.xxx.android.variantSelector'
androidVariantSelector {
moveOutputEnabled true
outputDirectoryPath "appstoreDelivery"
renameOutputEnabled true
}
android.applicationVariants.all { variant ->
variant.mergeResources.doFirst {
def buildType = java.lang.System.getenv("BUILD_TYPE") ?: java.lang.System.getProperty("BUILD_TYPE") ?: 'debug'
android.sourceSets[buildType].res.srcDirs = ["configs/$buildType"]
}
}
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.xxx.androidapp"
minSdkVersion 10
targetSdkVersion 23
multiDexEnabled true
archivesBaseName = "xxx-appli-android";
}
signingConfigs {
release {
storeFile file("code-signing/distribution/ter.keystore")
storePassword "tersncf2012"
keyAlias "ter"
keyPassword "tersncf2012"
}
}
lintOptions {
checkReleaseBuilds false
}
buildTypes {
release {
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
debug {
if (System.properties.getProperty('coverage')) {
testCoverageEnabled = true
}
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
sourceSets {
androidTest.setRoot('src/test')
instrumentTest.setRoot('src/test')
}
}
def bkFrameworkVersion = '2.1.2#aar-SNAPSHOT'
dependencies {
compile project(':xxx-android-library')
// 3rd party libs
compile('com.crashlytics.android:crashlytics:1.+') {
exclude module: 'support-v4'
}
// Bk framework libs
compile(group: 'com.xxx.bkdroid', name: 'bk-ui-adapters', version: bkFrameworkVersion) {
exclude module: 'support-v4'
}
compile(group: 'com.xxx.bkdroid', name: 'bk-ui-utils', version: bkFrameworkVersion) {
exclude module: 'support-v4'
}
compile(group: 'com.xxx.bkdroid', name: 'bk-ui-remoteimageview', version: bkFrameworkVersion) {
exclude module: 'support-v4'
}
compile(group: 'com.xxx.bkdroid', name: 'bk-ui-pagecontrol', version: bkFrameworkVersion) {
exclude module: 'support-v4'
}
compile(group: 'com.xxx.bkdroid', name: 'bk-ui-pagecontrol', version: bkFrameworkVersion) {
exclude module: 'support-v4'
}
compile files('libs/com.radaee.pdfex_view.jar')
compile files('libs/gcm.jar')
compile files('libs/dom4j.jar')
compile files('libs/libGoogleAnalytics.jar')
compile files('libs/library-2.4.0.jar')
//compile files('libs/urbanairship-lib-3.2.1.jar')
// Test ....
androidTestCompile files('testLibs/maps.jar')
androidTestCompile 'org.hamcrest:hamcrest-integration:1.1'
androidTestCompile 'org.hamcrest:hamcrest-core:1.1'
androidTestCompile 'org.hamcrest:hamcrest-library:1.1'
androidTestCompile('junit:junit:4.+') {
exclude module: 'hamcrest-core'
}
androidTestCompile('org.robolectric:robolectric:2.4') {
exclude module: 'classworlds'
exclude module: 'commons-logging'
exclude module: 'httpclient'
exclude module: 'maven-artifact'
exclude module: 'maven-artifact-manager'
exclude module: 'maven-error-diagnostics'
exclude module: 'maven-model'
exclude module: 'maven-project'
exclude module: 'maven-settings'
exclude module: 'plexus-container-default'
exclude module: 'plexus-interpolation'
exclude module: 'plexus-utils'
exclude module: 'support-v4'
exclude module: 'wagon-file'
exclude module: 'wagon-http-lightweight'
exclude module: 'wagon-provider-api'
}
androidTestCompile 'com.squareup:fest-android:1.0.+'
compile 'com.facebook:facebook-android-sdk:3.5.+#aar'
compile 'org.sufficientlysecure:html-textview:1.5'
compile 'com.android.support:support-v4:23.+'
// Urban Airship SDK
compile 'com.urbanairship.android:urbanairship-sdk:7.1.3'
// Recommended for in-app messaging
compile 'com.android.support:cardview-v7:23.3.0'
// Recommended for location services
compile 'com.google.android.gms:play-services-maps:9.4.0'
}
sonarRunner {
sonarProperties {
property "sonar.dynamicAnalysis", "reuseReports"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.jacoco.reportPath", "build/jacoco/testDebug.exec"
property "sonar.host.url", "http://sonar.backelite.com"
property "sonar.jdbc.url", "jdbc:mysql://thriller:3306/sonar?useUnicode=true&characterEncoding=utf8"
property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
property "sonar.jdbc.username", sonarDatabaseUserName
property "sonar.jdbc.password", sonarDatabasePassword
property "sonar.projectKey", "ter--appli-android"
property "sonar.projectName", "TER Android"
property "sonar.projectVersion", "1.6.3"
properties["sonar.sources"] = android.sourceSets.main.java.srcDirs
properties["sonar.tests"] = android.sourceSets.androidTest.java.srcDirs
properties["sonar.binaries"] = file("build/intermediates/classes/debug")
property "sonar.language", "java"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.profile", "Android Lint"
property "sonar.scm.url", "scm:svn:http://subversion.backelite.com/backelite/ter/ter-appli-android/trunk"
property "sonar.verbose", "true"
property "protectedAllowed", "true"
property "sonar.junit.reportsPath", "build/test-results"
property "sonar.exclusions", "**/radaee/**"
}
}
apply plugin: 'idea'
idea {
module {
testOutputDir = file('build/test-classes/debug')
}
}
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.7.1.201405082137"
}
def coverageSourceDirs = [
'../app/src/main/java'
]
task jacocoTestReport(type: JacocoReport) {
group = "Reporting"
description = "Generate Jacoco coverage reports"
classDirectories = fileTree(
dir: '../app/build/intermediates/classes/debug',
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/*$Provide*.*',
'**/*$Inject*.*',
'**/*$Module*.*',
'**/BuildConfig.*',
'**/Manifest*.*']
)
additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = files('../app/build/jacoco/testDebug.exec')
reports {
xml.enabled = true
html.enabled = true
}
}
And this is my xxx-android-library gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
version = '1.2#aar-SNAPSHOT'
group = 'com.ter.androidlib'
repositories {
mavenCentral()
maven {
url releasesRepoUrl
credentials {
username releasesRepoUsername
password releasesRepoPassword
}
}
maven {
url snapshotsRepoUrl
credentials {
username snapshotsRepoUsername
password snapshotsRepoPassword
}
}
maven {
url thirdPartyRepoUrl
credentials {
username thirdPartyRepoUsername
password thirdPartyRepoPassword
}
}
maven {
url 'http://download.crashlytics.com/maven'
}
maven {
url "http://JRAF.org/static/maven/2"
}
maven {
url "http://mente.github.io/facebook-api-android-aar"
}
}
android {
compileSdkVersion 16
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 15
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets {
main {
manifest {
srcFile 'AndroidManifest.xml'
}
java {
srcDir 'src'
}
res {
srcDir 'res'
}
assets {
srcDir 'assets'
}
resources {
srcDir 'src'
}
aidl {
srcDir 'src'
}
}
}
}
def bkFrameworkVersion = '2.1.2#aar-SNAPSHOT'
dependencies {
compile (group: 'com.xxx.bkdroid', name: 'bk-core', version: bkFrameworkVersion)
compile (group: 'com.xxx.bkdroid', name: 'bk-ui-adapters', version: bkFrameworkVersion)
compile (group: 'com.xxx.bkdroid', name: 'bk-ui-utils', version: bkFrameworkVersion)
compile (group: 'com.xxx.bkdroid', name: 'bk-utils', version: bkFrameworkVersion)
compile (group: 'com.xxx.bkdroid', name: 'bk-utils-log', version: bkFrameworkVersion)
compile (group: 'com.xxx.bkdroid', name: 'bk-jackson', version: bkFrameworkVersion)
compile (group: 'com.xxx.bkdroid', name: 'bk-db', version: bkFrameworkVersion)
compile (group: 'com.xxx.bkdroid', name: 'bk-network-webservice', version: bkFrameworkVersion)
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: releasesRepoUrl) {
authentication(userName: releasesRepoUsername, password: releasesRepoPassword)
}
snapshotRepository(url: snapshotsRepoUrl) {
authentication(userName: snapshotsRepoUsername, password: snapshotsRepoPassword)
}
pom.project {
name 'XXX Library for Android'
packaging 'aar'
}
}
}
}
Urban Airship is pulling in an older version of GCM from Google Play Services. Add: compile 'com.google.android.gms:play-services-gcm:9.4.0' to your dependencies.
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/"
}
}
}