I`m working on a project that compiles correctly but crashes on start when I set new maven repository on build.gradle file.
The project is using the lib holoeverywhere, and it crashes with the error: java.lang.NoClassDefFoundError: android.support.v4.app._HoloFragmentInflater$1
Until last month, everything was working fine, but suddenly the older company repository went offline and we created a new one. Now, if I set the older repository on my build.gradle file the app compiles and runs successfully, but if I remove the older repository, it still compiles but when I try to open it crash.
The main problem with that, is that new people trying to compile the code for the first time, using new or older repo, gets the crash on start.
So, I think this can be caused by some cache made by gradle, but looking at the .gradle folder I couldn't find anything.
Can some one help me with that?
Here is the build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
mavenCentral()
maven {
url "http://<new_repository_url>/artifactory/simple/libs-release-local/"
}
// if I remove comment from these lines the project runs correctly
//maven {
//url "https://<old_repository_url>/content/groups/AndroidPublicRepository/"
//}
maven {
url "http://holoeverywhere.cf/repo"
}
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1'
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 131
versionName '1.5'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/license.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/NOTICE.txt'
}
android {
lintOptions {
abortOnError false
}
}
productFlavors {
}
}
configurations {
all*.exclude(group: 'org.springframework', module: 'spring-core')
all*.exclude(group: 'org.springframework', module: 'spring-web')
all*.exclude(group: 'org.hamcrest', module: 'hamcrest-core')
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'com.android.support:support-v13:19.1.0'
compile 'org.holoeverywhere:library:2.1.0'
compile 'com.viewpagerindicator:viewpagerindicator:2.4.1'
compile 'com.googlecode.libphonenumber:libphonenumber:5.9'
compile 'de.keyboardsurfer.android.widget:crouton:1.8.4'
compile 'com.google.code.gson:gson:2.3'
compile 'com.octo.android.robospice:robospice:1.4.14'
compile 'com.octo.android.robospice:robospice-cache:1.4.14'
compile 'com.octo.android.robospice:robospice-spring-android:1.4.14'
compile 'org.springframework.social:spring-social-core:1.0.2.PATCHED'
compile('org.springframework.android:spring-android-auth:1.0.1.RELEASE') {
exclude group: 'org.springframework.social', module: 'spring-social-core'
}
compile project(':addon-preferences-2.1.0')
}
I recommend you to remove HoloEverywhere from your app. It was a great library, but it isn't now. It's not very difficult: just change imports, some little adjustments and minSdkVersion = 15. Other option: Material Design.
Anyway, if you can't remove it or you can't do it right now:
HoloEverywhere had a dependency with a patched support-v4. I think the problem is that you don't have this patched version at your maven repository. You can find this code in the branch support-library.
Related
I am trying to use Apache POI in my Android application so that I can read Microsoft Word files. I am integrating the POIA library which enables Apache POI usage on Android (https://github.com/SUPERCILEX/poi-android). However, when I run my code and read in a Word file, I receive the following error:
Exception: org.apache.xmlbeans.SchemaTypeLoaderException: Cannot
resolve type for handle _XY_Q=space|R=space
Below is my code (I am receiving error on the first line):
var document = XWPFDocument(uri?.let { contentResolver.openInputStream(it) });
var extractor = XWPFWordExtractor(document);
var documentText = extractor.text; // Retrieve the document's text
At runtime I have the following code:
super.onCreate(savedInstanceState)
System.setProperty("org.apache.poi.javax.xml.stream.XMLInputFactory", "com.fasterxml.aalto.stax.InputFactoryImpl")
System.setProperty("org.apache.poi.javax.xml.stream.XMLOutputFactory", "com.fasterxml.aalto.stax.OutputFactoryImpl")
System.setProperty("org.apache.poi.javax.xml.stream.XMLEventFactory", "com.fasterxml.aalto.stax.EventFactoryImpl")
Below is my gradle (project-level):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.60'
repositories {
google()
jcenter()
}
ext {
poiVersion = '3.17'
}
dependencies {
classpath 'com.android.tools:r8:1.4.93'
classpath 'com.android.tools.build:gradle:3.4.2'
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()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Below is my gradle (app-level):
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.diffchecker"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// For developers using the Android Support Library
implementation 'pub.devrel:easypermissions:2.0.1'
implementation 'com.google.android.gms:play-services-ads:18.3.0'
implementation ("com.github.SUPERCILEX.poi-android:poi:$poiVersion") {
exclude group: 'stax', module: 'stax-api'
}
}
Below is the full stack trace:
I/System.out: Exception: org.apache.xmlbeans.SchemaTypeLoaderException: Cannot resolve type for handle _XY_Q=space|R=space#http://www.w3.org/XML/1998/namespace (schemaorg_apache_xmlbeans.system.sF1327CCA741569E70F9CA8C9AF9B44B2.cttext7f5btype) - code 13
IMPORTANT: I am trying to read in the contents of a Word file the USER SELECTED, not a Word file from a hardcoded path.
Please include ALL the relevant code in your answer, and your code should work on Android API 22.
owner of the lib here. poi-android has only been tested with Excel files and is tailored to work well with proguard to minimize binary size for an app I wrote.
If I had to guess, this is causing your issue. For a more generic version of POI, use https://github.com/centic9/poi-on-android (which is what my lib is based off of). You'll have to include the JAR from the releases section into your source tree and add this Gradle dependency: implementation files('path/to/file.jar'). However, as you'll notice, the lib is quite large (13MB+), hence the reasoning behind modifying POI to my use case. I would recommend forking one of the libs and tailoring it to your use case.
Did you add proper packagingOptions in build.gradle ?
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}
Also enable multiDexEnabled
On my latest release a few of my users (less than 0.2%) are getting a crash because android.support.v7.app.AppCompatDelegateImplV23 can not be found. I can not reproduce the issue, I'm only getting reports over crashlytics. I have used apktool to extract the files out of my apk and I can see AppCompatDelegateImplV23.smali in there. Any idea what could be happening?
This is my compile line on gradle:
compile 'com.android.support:appcompat-v7:23+'
This is the exception:
Fatal Exception: java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV23
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:133)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:117)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:456)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
at MyActivityClass.onCreate(MyActivityClass.java:353)
at android.app.Activity.performCreate(Activity.java:6248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:117)
EDIT: This is my main gradle file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter() // version plugin support
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.android.tools.build:gradle:1.3.1'
}
allprojects {
repositories {
jcenter()
}
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
signingConfigs {
config {
......
}
}
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
productFlavors {
// Define separate dev and prod product flavors.
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion 14
}
}
defaultConfig {
applicationId "mypackage"
minSdkVersion 14
targetSdkVersion 23
versionCode some number
versionName "some version number"
multiDexEnabled true
signingConfig signingConfigs.config
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(output.outputFile.parent,"myapk.apk")
}
}
}
debug {
signingConfig signingConfigs.config
}
}
repositories {
mavenCentral()
mavenLocal()
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'AndroidManifest.xml'
exclude 'META-INF/beans.xml'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
}
productFlavors {
}
dexOptions {
// preDexLibraries = false
jumboMode = true
javaMaxHeapSize "2g"
//doesn't seem to be supported with multidex
// incremental true
}
lintOptions{
disable 'MissingTranslation'
disable 'ExtraTranslation'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//multidex
compile 'com.android.support:multidex:1.0.0'
//support libs
compile 'com.android.support:support-v4:23+'
compile 'com.android.support:appcompat-v7:23+'
compile 'com.android.support:cardview-v7:23+'
compile 'com.android.support:design:23+'
//app invites
compile 'com.google.android.gms:play-services-appinvite:8+'
compile 'com.google.android.gms:play-services-analytics:8+'
//chromecast
compile 'com.google.android.gms:play-services-cast:8+'
compile 'com.android.support:mediarouter-v7:23+'
//plus button
compile 'com.google.android.gms:play-services-plus:8+'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile 'com.github.navasmdc:MaterialDesign:1.+#aar'
//material lib needs it
compile 'com.nineoldandroids:library:2.4.+'
compile 'com.facebook.stetho:stetho:1+'
compile 'com.facebook.stetho:stetho-okhttp:1+'
//debugCompile 'com.squareup.leakcanary:leakcanary-android:1+'
debugCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1+'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1+'
compile 'com.makeramen:dragsortadapter:1.3+'
compile 'com.github.amlcurran.showcaseview:library:5.0.0'
}
EDIT: just had a new report but for a different version of the same class
Fatal Exception: java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:135)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:117)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:456)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
at MyActivity.onCreate(MyActivity.java:353)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2044)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2105)
at android.app.ActivityThread.access$600(ActivityThread.java:133)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1211)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4795)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(NativeStart.java)
EDIT: I've just gone over a lot of the reports, some are for AppCompatDelegateImplV23 and some are for AppCompatDelegateImplV14, some involved XPosed but most don't. The one thing that is common to all of them is that they are all for rooted phones.
First of all, we need to understand why java.lang.NoClassDefFoundError error occurs :
So the answer is that when there is a class file that your code depends on and it is present at compile time but not found at runtime. Look for differences in your build time and runtime classpaths.
So there are some options by that you can remove this error:
1) Make preDexLibraries to true:
dexOptions {
preDexLibraries = true
jumboMode = true
javaMaxHeapSize "2g"
//doesn't seem to be supported with multi dex
// incremental true
}
2) There may be the problem with the incremental build system. So try to try to remove your build folder from your project and Rebuild the project OR Right click on your project -> "Open module settings" -> Dependencies tab -> check if Export is checked for your library
3) You need to do more than just provide MultiDex support.
multiDexEnabled = true in your defaultConfig block
Include compile 'com.android.support:multidex:1.0.0' in your dependencies
Have your Application class extend MultiDexApplication instead of just Application. Alternatively, you can call MultiDex.install() in attachBaseContext() of your application
For more reference you can check the below link which has provided more advance understanding of multi dex.
https://developer.android.com/tools/building/multidex.html
4) Or at last you can add jar files of V7 into your project's libs folder and then add it your build System.
5) Also try removing the jar files as well as it still includes the com.android.support:support-v4:23+ as gradle has a repository where it downloads the jars delcared like compile 'compile 'com.android.support:appcompat-v7:23+'
Hope this can give you some clue about your error.
My guess is that the problem is due to the xposed framework. At the bottom of the stack trace, you can find that the zygote was started by the xposed framework.
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:117)
This means that the user is using a custom Android rom with the xposed framework installed. The framework is usually used to modify the behavior of the Android framework (and any app of course) code by injecting new code at run-time.
You can check how it works at: https://github.com/rovo89/XposedBridge/tree/art/app/src/main/java/de/robv/android/xposed
Since the code behavior can be altered in various degrees depending on what mods are installed via the xposed framework, I cannot pinpoint the exact cause of your exception. However, if all the stack traces you have got start with the XposedBrigde.main(), then I can say that your problem is due to the exposed framework or the mods installed via the framework.
I recently updated my kotlin and kotlin extensions plugin and while building I am getting the following error. I tried clean build or sync project with gradle but nothing works
e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
Error:Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details
The build.gradle is as follows
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
buildscript {
ext.kotlin_version = '1.0.0-beta-1038'
ext.anko_version = '0.7.2'
ext.android_support_version = '23.0.1'
ext.android_extensions_version = '1.0.0-beta-1038'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.xxxxxxxxxx.app"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
debug.java.srcDirs += 'build/generated/src/main/debug'
release.java.srcDirs += 'build/generated/src/main/release'
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
repositories {
jcenter()
mavenCentral()
jcenter { url "https://jitpack.io" }
}
dependencies {
provided fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'io.realm:realm-android:0.83.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.1.3'
compile 'com.braintreepayments.api:braintree:1.+'
compile('com.mikepenz:materialdrawer:4.4.1#aar') {
transitive = true
}
compile 'com.mikepenz:google-material-typeface:1.2.0.1#aar'
compile project(':temperature')
compile project(':heart')
compile project(':lungs')
compile "com.android.support:cardview-v7:$android_support_version"
compile 'com.github.wendykierp:JTransforms:3.1'
compile 'fuel:fuel:0.57'
compile "org.jetbrains.anko:anko-sdk15:$anko_version"
compile "org.jetbrains.anko:anko-support-v4:$anko_version"
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'com.google.android.gms:play-services:8.1.0'
compile "com.android.support:recyclerview-v7:$android_support_version"
compile "com.android.support:appcompat-v7:$android_support_version"
compile "com.android.support:support-v4:$android_support_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
can someone point out what is the issue with this?
Thanks
I solved this problem by building the project in terminal then run app in intellij(or android studio).
gradle clean build -> run app in ide
For me, the solution was to open the Gradle Console window in Android Studio and run the build with a StackTrace.
Then, reading through that, I realised that the new of doing some things in Kotlin required my code to change, but a normal Gradle build didn't catch those problems.
It was things like views being cast to TextView or whatever the case might be, that was not relevant anymore, and had to be changed to the findVieById format. e.g.:
val textView = snackbarView.findViewById(R.id.snackbar_text) as TextView
had to be changed to
val textView = snackbarView.findViewById<TextView>(R.id.snackbar_text)
In the case of a project I was recently working on, I was getting the same kind of error, which was caused by a call to a static method that no longer existed.
MessageService.java
public class MessageService extends FirebaseMessagingService {
/*
This method was commented out
private static String GetReviewTopic(String userId)
{
return "/topics/"+userId+"/review";
}
*/
}
AppActivity.java
#Override
public void onCreate() {
...
/*
No complication error was caused despite the
method not being defined.
*/
MessageService.GetReviewTopic(currentUser);
...
}
Unfortunately Android Studio wasn't reporting a "syntax error" for the missing static method, nor were there any meaningful complication errors that helped me track the issue down.
Hope this answer is able to save someone a few hours of troubleshooting!
I have a project on GitHub that I work on both in the office at home. For about 2 months it was working fine on both machines. Then two weeks ago, it stopped running on my home PC, but still works fine on my work PC.
This is the error I get:
:app:shrinkDebugMultiDexComponents FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:shrinkDebugMultiDexComponents'.
java.io.IOException: Can't read [D:\dev\gitRepo\app\android\app\build\intermediates\multi-dex\debug\allclasses.jar] (Can't process class [__MACOSX/com/stripe/android/._BuildConfig.class] (Invalid magic number [51607] in class))
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
The stripe package that is giving me errors is a 3rd party library that you can find here. I list it as a dependency in my build.gradle file exactly as they say to.
compile 'com.stripe:stripe-android:+'
I have commented out all code pertaining the stripe and the app runs completely fine, so I do know it has something to do with how I am handling that package.
Unfortunately I don't remember exactly what I had done to make this stop working. I do think that the week before this happened I upgraded Android Studio, and spent a considerable amount of time messing with ProGuard configurations.
What I have tried:
Working on the master branch where no ProGuard changes have been made.
Uninstalling and Reinstalling Android Studio
Re-cloning the git repo
Installing API 17 (stripe for eclipse requires this. Not Studio but I gave it a shot).
Contacting stripe customer support but they had no clue.
This stack overflow post. However, there is no Mac computer that has touched the project nor have I personally zipped anything related to stripe.
From here, converted the magic number from Hex to ASCII. The result was Q` which I do not recognize.
I think it may have something to do with something I did for ProGuard, but I don't understand how. I'm on a completely different branch than any Proguard work, with a clean AndroidStudio install, with a clean repository clone, and the project still works fine when I'm in the office.
EDIT
I am running this on the debug BuildType. These are my 3 gradle files. The first is for the entire Project, the second is for the Application Module, and the third is for a local android library Module.
Project build.gradle:
buildscript {
repositories {
jcenter()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
allprojects {
repositories {
jcenter()
maven{ url 'http://download.crashlytics.com/maven' }
}
}
Android Application Module 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' }
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.app.android"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
minSdkVersion 16
targetSdkVersion 22
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
buildConfigField 'Boolean', 'enableCrashlytics', 'true'
}
debug {
buildConfigField 'Boolean', 'enableCrashlytics', 'false'
}
adhoc {
debuggable true
signingConfig signingConfigs.debug
buildConfigField 'Boolean', 'enableCrashlytics', 'true'
}
}
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'
}
}
dependencies {
compile project(':localLibrary')
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
compile 'commons-io:commons-io:2.4'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:support-v4:22.0.1'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
compile 'com.google.android.gms:play-services-maps:8.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'io.card:android-sdk:5.0.1'
compile 'com.stripe:stripe-android:+'
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true;
}
}
Local Android Library Module build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:22.1.0'
compile 'com.google.code.gson:gson:2.2.2'
compile 'com.android.support:multidex:1.0.0'
compile group: 'org.apache.httpcomponents' , name: 'httpmime' , version: '4.3.5'
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
}
This problem is probably related to the version of Java that you are running. I had a similar problem and discovered that Java 8 was used for the build. When I changed to Java 7, this build problem was fixed.
In Android Studio go to
File -> Project Structure -> SDK Location
The JDK Location should be Java 1.7.x (Java 7)
Yeah verify both machines have the same Java version, and indeed the same version of Android Studio. The only other thing I can think of is that maybe Stripe is using the build tools bundled with AS to build your apk, and the ones you have installed by default differ slightly and are missing something - see this post I made on a similar problem I had.
I freshly deployed an Android library named TypedPreferences. I used it in another Android project for some days. Suddenly, it stopped working - dependencies cannot be found any longer. I noticed that Gradle only downloads one file when I clean the project:
Download http://repo1.maven.org/maven2/info/metadude/android/typed-preferences/ \
1.0.0/typed-preferences-1.0.0.aar.asc
These are build files of my pet project:
build.gradle:
// Top-level build file where you can add configuration
// options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
allprojects {
repositories {
mavenCentral()
maven {
url "${System.env.HOME}/.m2/repository"
}
maven {
url "https://github.com/novoda/public-mvn-repo/raw/master/releases"
}
}
}
app/build.gradle:
apply plugin: 'android'
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile 'com.android.support:support-v4:19.0.+'
compile 'com.android.support:appcompat-v7:19.0.+'
compile 'com.squareup.okhttp:okhttp:1.3.+'
compile 'com.fasterxml.jackson.core:jackson-databind:2.2.+'
compile 'com.fasterxml.jackson.core:jackson-core:2.2.+'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.+'
compile 'com.novoda:sqliteprovider-core:1.0.+'
compile 'com.androidmapsextensions:android-maps-extensions:2.1.+'
compile 'com.google.android.gms:play-services:3.2.+'
compile 'info.metadude.android:typed-preferences:1.0.0'
}
As you can see, I also enable Gradle to look into my local Maven cache here:
maven {
url "${System.env.HOME}/.m2/repository"
}
I deleted the relevant folders to avoid Gradle loading stuff from there.
There might be a misconfiguration in the build.gradle files of the library - please find them here:
Library files
Please tell me also whether I can test your fix locally without deploying to Maven Central.
Looks like the packaging element of the published POM has the wrong value. It should be aar, not aar.asc.
Also, you always can force the type of artifact to download. Just add dependency like:
compile "group:artifact:version#type"
And in your case it will be
compile "info.metadude.android:typed-preferences:1.0.0#aar"
That's it.