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.
Related
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!
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.
When I am trying to build project in Android Studio I get the following error:
Error:Execution failed for task ':hunter:packageDebug'.
> Unsupported manifest version: 1.
When I clean project then I can run it normally, but then I need to clean it again before next build. It is really disturbing. I thought that Gradle and Adnroid version bump will help, but it changed nothing.
app build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
defaultConfig {
applicationId "com.gamekit.gkquiz"
minSdkVersion 17
targetSdkVersion 27
versionCode 15
versionName "1.2.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
signingConfigs {
config {
keyAlias 'gamekit-key'
keyPassword kspass
storePassword kspass
storeFile file('../gamekit-release-key.jks')
}
}
buildTypes {
release {
ext.betaDistributionReleaseNotesFilePath = "crashlytics_release_notes.txt"
ext.betaDistributionGroupAliases = "android-testers"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
sourceSets {
String sharedTestDir = 'src/sharedTest/java'
test {
java.srcDir sharedTestDir
}
androidTest {
java.srcDir sharedTestDir
}
}
packagingOptions {
pickFirst 'META-INF/*'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
implementation project(':common')
kapt libs.activitystarter_kapt
implementation libs.paper_parcel
kapt libs.paper_parcel_kapt
compile ('com.github.kwizzad:kwizzad-android:2.0.2') {
exclude group:"com.android.support"
exclude group:"com.google.android.gms"
}
androidTestImplementation(libs.espresso_core, {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
testImplementation libs.junit
}
common build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.23.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
buildToolsVersion '27.0.1'
defaultConfig {
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
}
lintOptions {
abortOnError false
}
}
kapt {
generateStubs = true
}
dependencies {
implementation fileTree(dir: 'lib', include: '*.jar')
api libs.kotlin
api libs.android_support
api libs.retrofit
api libs.rx
api libs.glide
implementation libs.facebook_ads
api('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true
}
api 'com.github.MarcinMoskala:KotlinAndroidViewBindings:0.10'
api libs.preference_holder
api libs.activitystarter
api group: 'joda-time', name: 'joda-time', version: '2.9.9'
api group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
implementation 'com.facebook.android:facebook-android-sdk:4.25.0'
implementation 'com.vk:androidsdk:1.6.8'
implementation 'com.google.firebase:firebase-ads:11.2.0'
implementation 'com.google.firebase:firebase-auth:11.2.0'
implementation 'com.google.android.gms:play-services-auth:11.2.0'
api 'com.github.marcinmoskala:ArcSeekBar:0.34'
implementation libs.multidex
androidTestImplementation(libs.espresso_core, {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation libs.junit
}
Project build.gradle
buildscript {
ext.kotlin_version = '1.2.0-rc-39'
ext.retrofit_version = '2.3.0'
ext.okhttp_version = '3.6.0'
ext.android_version = '27.0.1'
ext.activity_starter_version = '1.00'
ext.preference_holder_version = '1.51'
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.2' }
maven { url "https://kotlin.bintray.com/kotlinx" }
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-alpha04'
classpath 'com.google.gms:google-services:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'io.fabric.tools:gradle:1.23.0'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
maven { url 'https://maven.fabric.io/public' }
maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.2" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext.libs = [
minions : 'com.github.marcinmoskala:minions:0.082',
preference_holder : ["com.marcinmoskala.PreferenceHolder:preferenceholder:$preference_holder_version",
"com.marcinmoskala.PreferenceHolder:preferenceholder-gson-serializer:$preference_holder_version",],
kotlin : "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version",
android_support : ["com.android.support:support-v4:$android_version",
"com.android.support:appcompat-v7:$android_version",
"com.android.support:cardview-v7:$android_version",
"com.android.support:recyclerview-v7:$android_version",
"com.android.support:design:$android_version"],
retrofit : ["com.squareup.retrofit2:retrofit:$retrofit_version",
"com.squareup.retrofit2:adapter-rxjava2:$retrofit_version",
"com.squareup.retrofit2:converter-gson:$retrofit_version",
"com.squareup.retrofit2:converter-scalars:$retrofit_version",
"com.squareup.okhttp3:okhttp:$okhttp_version",
"com.squareup.okhttp3:logging-interceptor:$okhttp_version"],
facebook_ads : 'com.facebook.android:audience-network-sdk:4.22.1',
rx : ['io.reactivex.rxjava2:rxjava:2.0.9',
'io.reactivex.rxjava2:rxandroid:2.0.1'],
activitystarter : ["com.marcinmoskala.activitystarter:activitystarter:$activity_starter_version",
"com.marcinmoskala.activitystarter:activitystarter-kotlin:$activity_starter_version"],
activitystarter_kapt: "com.marcinmoskala.activitystarter:activitystarter-compiler:$activity_starter_version",
joda_time : ['joda-time:joda-time:2.9.3',
'com.fatboyindustrial.gson-jodatime-serialisers:gson-jodatime-serialisers:1.2.0'],
event_bus : 'de.greenrobot:eventbus:2.4.0',
crashlytics : 'com.crashlytics.sdk.android:crashlytics:2.5.0#aar',
material_dialog : 'com.afollestad.material-dialogs:core:0.9.0.1',
glide : 'com.github.bumptech.glide:glide:3.7.0',
paper_parcel : ['com.github.grandstaish.paperparcel:paperparcel:1.0.0',
'com.github.grandstaish.paperparcel:paperparcel-kotlin:1.0.0'],
paper_parcel_kapt : 'com.github.grandstaish.paperparcel:compiler:1.0.0',
multidex : 'com.android.support:multidex:1.0.2',
junit : 'junit:junit:4.12',
espresso_core : 'com.android.support.test.espresso:espresso-core:2.2.2',
mockito : 'org.mockito:mockito-core:1.10.19'
]
Have you tried downgrading gradle i.e changing
'com.android.tools.build:gradle:3.1.0-alpha04'
to
'com.android.tools.build:gradle:3.0.0'
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/"
}
}
}
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'
}