Could not resolve all files for configuration CompileClasspath - android

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"

Related

Android build suddenly starts failing with : resource android:attr/fontVariationSettings not found

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!

Andriod Build failing due to com.android.support:support-vector-drawable:26.0.2 depends on one or more Android Libraries

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.

Library conflict error

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.

Android Studio Robolectric missing android.R

I have a very hard time solving this problem in Android studio.
I have made an app, and trying to test it with this Robolectric test tool, but it seems like robolectric cant find android jar files although android jar is running perfectly when i run the app by it self. My friend has a clone of the test and the app at his computer, and here i runs perfectly. What i wrong ?
Please help me out here.
This is the failure:
java.lang.NoClassDefFoundError: android/R
at org.robolectric.bytecode.Setup.(Setup.java:39)
at org.robolectric.RobolectricTestRunner.createSetup(RobolectricTestRunner.java:137)
at org.robolectric.RobolectricTestRunner.createSdkEnvironment(RobolectricTestRunner.java:114)
at org.robolectric.RobolectricTestRunner$3.create(RobolectricTestRunner.java:307)
at org.robolectric.EnvHolder.getSdkEnvironment(EnvHolder.java:21)
at org.robolectric.RobolectricTestRunner.getEnvironment(RobolectricTestRunner.java:305)
at org.robolectric.RobolectricTestRunner.access$300(RobolectricTestRunner.java:61)
And this is the app gradle file:
apply plugin: 'com.android.application'
apply plugin: 'robolectric'
apply plugin: 'idea'
android {
compileSdkVersion 18
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.kea.project.wheeloffortune"
minSdkVersion 16
targetSdkVersion 18
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets {
androidTest {
setRoot('src/test')
}
}
}
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
classpath 'org.robolectric:robolectric-gradle-plugin:0.12.+'
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile files('libs/commons-lang3-3.3.2.jar')
compile files('libs/picasso-2.2.0.jar')
compile files('libs/volley.jar')
compile files('libs/espresso-1.1.jar')
compile files('libs/testrunner-1.1.jar')
compile files('libs/testrunner-runtime-1.1.jar')
androidTestCompile files('lib/espresso-1.1.jar')
androidTestCompile files('lib/testrunner-1.1.jar')
androidTestCompile files('lib/testrunner-runtime-1.1.jar')
androidTestCompile 'com.google.guava:guava:14.0.1'
androidTestCompile 'com.squareup.dagger:dagger:1.1.0'
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.11') {
exclude module: 'hamcrest-core'
}
androidTestCompile('org.robolectric:robolectric:2.3') {
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: 'wagon-file'
exclude module: 'wagon-http-lightweight'
exclude module: 'wagon-provider-api'
}
androidTestCompile 'com.squareup:fest-android:1.0.+'
}
idea {
module {
testOutputDir = file('build/test-classes/debug')
}
}
task addTest {
def src = ['src/test/java']
def file = file("app.iml")
doLast {
try {
def parsedXml = (new XmlParser()).parse(file)
def node = parsedXml.component[1].content[0]
src.each {
def path = 'file://$MODULE_DIR$/' + "${it}"
def set = node.find { it.#url == path }
if (set == null) {
new Node(node, 'sourceFolder', ['url': 'file://$MODULE_DIR$/' + "${it}", 'isTestSource': "true"])
def writer = new StringWriter()
new XmlNodePrinter(new PrintWriter(writer)).print(parsedXml)
file.text = writer.toString()
}
}
} catch (FileNotFoundException e) {
// nop, iml not found
}
}
}
gradle.projectsEvaluated {
preBuild.dependsOn(addTest)
}
robolectric {
include '**/*Test.class'
exclude '**/espresso/**/*.class'
}

Robolectric, Gradle, Espresso With Flavors

I was using this template to incorporate robolectric tests but it's not working because I use flavors and I get this error:
Error:Could not find property 'testRelease' on project ':Component_Tests'.
How can I fix this? I'm using 2 flavors and 3 build types. Here's the gradle file:
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:0.12.1+'
classpath "com.neenbedankt.gradle.plugins:android-apt:1.2"
}
}
apply plugin: 'android'
apply plugin: 'android-apt'
apply from : "$rootDir/gradle/signing.gradle"
apply from : "$rootDir/gradle/build_extras.gradle"
apply from : "$rootDir/gradle/environments.gradle"
loadConfiguration()
apply from : "$rootDir/gradle/checkstyle.gradle"
apply from : "$rootDir/gradle/pmd.gradle"
apply from : "$rootDir/gradle/findbugs.gradle"
apply from : "$rootDir/gradle/espresso.gradle"
tasks.whenTaskAdded { task ->
if (task.name.startsWith('connectedAndroidTest')) {
task.dependsOn grantAnimationPermission
}
}
def loadPropertiesFile = { filePath ->
def propertiesFile = file(filePath)
def Properties properties = new Properties()
if (!propertiesFile.canRead()) {
throw new GradleException("cannot read " + filePath)
}
properties.load(new FileInputStream(propertiesFile))
return properties
}
def writePropertiesFile = { filePath, properties ->
def propertiesFile = file(filePath)
if (!propertiesFile.canRead()) {
throw new GradleException("cannot read " + filePath)
}
properties.store(propertiesFile.newWriter(), null)
}
def loadAndStorePropertyFile = { filePath, propertyName, value ->
def Properties properties = loadPropertiesFile(filePath)
properties[propertyName] = value.toString()
writePropertiesFile(filePath, properties)
println "$propertyName is set to $value"
}
def getVersionCode = { ->
def Properties versionProperties = loadPropertiesFile('../version.properties')
return versionProperties['VERSION_CODE'].toInteger()
}
def getAlphaHash = { ->
def Properties versionProperties = loadPropertiesFile('../version.properties')
return versionProperties['LAST_ALPHA_HASH'].toString()
}
def getBetaHash = { ->
def Properties versionProperties = loadPropertiesFile('../version.properties')
return versionProperties['LAST_BETA_HASH'].toString()
}
def getReleaseCandidateHash = { ->
def Properties versionProperties = loadPropertiesFile('../version.properties')
return versionProperties['LAST_RC_HASH'].toString()
}
def getCurrentHash = { ->
def cmd = "git rev-parse --short HEAD"
def gitProcess = cmd.execute()
def gitHash = gitProcess.text.trim()
return gitHash
}
def getReleaseNotes = { ->
def Properties versionProperties = loadPropertiesFile('../version.properties')
return versionProperties['NOTES'].toString()
}
def getReleaseNotesSinceHash = { hash ->
def cmd = "git log --pretty=-%x20[%h]%x20%s%n " + hash + "..HEAD"
def gitProcess = cmd.execute()
def notes = gitProcess.text.trim()
loadAndStorePropertyFile( '../version.properties', 'NOTES', notes)
}
def copyAndRenameZipAlignedPackage = { variant ->
def timeStamp = (int)(new Date().getTime() / 1000)
def versionCode = getVersionCode()
def gitHash = getCurrentHash()
def environment = project.environment
def file = variant.zipAlign.outputFile
def copyTask = project.tasks.create("copy${variant.name}Apk", Copy)
copyTask.from(file)
copyTask.into(file.parent)
if (variant.buildType.name == "release") {
copyTask.rename(".apk", "-" + environment + "-" + versionCode + "-"
+ gitHash + "-" + timeStamp + "-RELEASE.apk");
} else {
copyTask.rename(".apk", "-" + environment + "-" + versionCode + "-"
+ gitHash + "-" + timeStamp + "-SNAPSHOT.apk");
}
variant.assemble.dependsOn copyTask
copyTask.dependsOn variant.zipAlign
}
android {
compileSdkVersion 19
buildToolsVersion '19.1'
useOldManifestMerger true
defaultConfig {
applicationId 'com.example.app’
minSdkVersion 14
targetSdkVersion 19
versionCode getVersionCode()
testInstrumentationRunner 'com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner'
}
productFlavors {
dev {
// For explicit testing with Espresso and other frameworks.
}
hockey {
// For distro to stakeholders.
}
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
abortOnError true
}
jacoco {
version = '0.6.2.201302030002'
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
androidTest.setRoot('tests')
debug.setRoot('build-types/debug')
beta.setRoot('build-types/beta')
release.setRoot('build-types/release')
dev.setRoot('build-types/dev')
hockey.setRoot('build-types/hockey')
}
buildTypes {
debug {
applicationIdSuffix '.debug'
debuggable true
// still broken with dagger (espresso's dependency) as of 0.11.1
// https://code.google.com/p/android/issues/detail?id=69174
testCoverageEnabled false
}
beta {
applicationIdSuffix '.beta'
debuggable true
testCoverageEnabled false
signingConfig signingConfigs.betaSigning
}
release {
runProguard false
proguardFile 'proguard-config.txt'
signingConfig signingConfigs.releaseSigning
}
}
applicationVariants.all { variant ->
removeSetAnimationScaleFromManifest(variant)
task("generate${variant.name}Javadoc", type: Javadoc) {
description "Generates Javadoc for $variant.name."
group "Code Quality"
def Properties localProperties = loadPropertiesFile('../local.properties')
source = variant.javaCompile.source
classpath = files(variant.javaCompile.classpath.files) +
files(localProperties['sdk.dir'] + "/platforms/android-4.4.2/android.jar")
}
copyAndRenameZipAlignedPackage(variant)
}
}
apply plugin: 'monkey'
monkey {
teamCityLog = false
eventCount = 5000
seed = 42
failOnFailure = false
install = false
}
apply plugin: 'hockeyApp'
hockeyapp {
apiToken = “xxxxx”
releaseType = 0
notify = 0
status = 2
notesType = 1
commitSha = getCurrentHash()
notes = getReleaseNotes()
variantToApplicationId = [
hockeyDebug: “xxxxx”,
hockeyBeta: “xxxxx”,
hockeyRelease: “xxxxx”
]
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':android_ngn_stack:android-ngn-stack')
compile project(':SlidingMenuLibrary')
compile 'com.android.support:support-v4:19.1.+'
compile 'com.google.android.gms:play-services:5.0.77'
compile 'org.apache.james:apache-mime4j:0.6'
compile 'org.apache.httpcomponents:httpmime:4.2.3'
compile 'org.jsoup:jsoup:1.6.3'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.googlecode.ez-vcard:ez-vcard:0.9.3'
compile 'com.googlecode.libphonenumber:libphonenumber:5.9'
compile 'net.hockeyapp.android:HockeySDK:3.0.2'
compile("org.springframework.android:spring-android-auth:1.0.1.RELEASE") { exclude module: '*' }
compile("org.springframework.android:spring-android-core:1.0.1.RELEASE") { exclude module: '*' }
compile("org.springframework.android:spring-android-rest-template:1.0.1.RELEASE") { exclude module: '*' }
apt "org.androidannotations:androidannotations:" + androidAnnotationsVersion
provided 'com.jakewharton.espresso:espresso:1.1-r3'
androidTestCompile 'com.jakewharton.espresso:espresso:1.1-r3'
}
apt {
arguments {
androidManifestFile variant.processResources.manifestFile
resourcePackageName 'com.example’
}
Here's the test module gradle file:
buildscript {
dependencies {
classpath "com.android.tools.build:gradle:" + androidToolsBuildGradle
classpath "com.novoda:gradle-android-test-plugin:0.9.9-SNAPSHOT"
}
}
apply plugin: 'java'
test.reports.html.enabled = false // just clean up dashboard from not generated reports
test.reports.junitXml.enabled = false // just clean up dashboard from not generated reports
apply plugin: 'android-test'
apply plugin: "jacoco"
gradle.taskGraph.beforeTask { task ->
if (task.name == "compileTestJava") {
task.deleteAllActions()
println "Task $task.name is being rendered useless"
}
}
//Note - Alphabetical order matters for projectUnderTest
android {
projectUnderTest ':Acision_RCS_Client'
}
dependencies {
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile('com.squareup:fest-android:1.0.+') { exclude module: 'support-v4' }
testCompile('org.robolectric:robolectric:2.3') {
exclude module: 'classworlds'
exclude module: 'maven-artifact'
exclude module: 'maven-artifact-manager'
exclude module: 'maven-error-diagnostics'
exclude module: 'maven-model'
exclude module: 'maven-plugin-registry'
exclude module: 'maven-profile'
exclude module: 'maven-project'
exclude module: 'maven-settings'
exclude module: 'nekohtml'
exclude module: 'plexus-container-default'
exclude module: 'plexus-interpolation'
exclude module: 'plexus-utils'
exclude module: 'support-v4' // crazy but my android studio don't like this dependency and to fix it remove .idea and re import project
exclude module: 'wagon-file'
exclude module: 'wagon-http-lightweight'
exclude module: 'wagon-http-shared'
exclude module: 'wagon-provider-api'
}
}
apply from: "$rootDir/gradle/jacoco-support.gradle"
apply from: "$rootDir/gradle/android-studio-robolectric-support.gradle"
If you use product flavours, gradle will not find the "testRelease" task. You need to use the correct naming with the flavour, e.g. testFlavourRelease (Flavour must be replaced by a existing flavour name used in your project)

Categories

Resources