Error trying to use HelloCharts - Unexpected Top Level Exception - android

I tried to avoid asking this question since it has been asked numerous times on this site. I have tried every which way to successfully run my app with HelloCharts included but have failed too many times. I have moved the dependencies around as well as the repositories hoping it would fix it but no luck.
I am getting a top level exception every time I try to run my app. Below is my build.gradle (app).Thank you in advance for your help.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "REMOVED FOR THIS POST"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.github.lecho:hellocharts-library:1.5.8#aar'
compile 'com.github.lecho:hellocharts-android:v1.5.8'
}
Here are the instructions from github:
Android Studio/Gradle
Maven Central/jCenter, add dependency to your build.gradle:
dependencies{
compile 'com.github.lecho:hellocharts-library:1.5.8#aar'
}
JitPack.io, add jitpack.io repositiory and dependency to your build.gradle:
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile 'com.github.lecho:hellocharts-android:v1.5.8'
}
Here is the error I keep getting:
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: `com.android.ide.common.process.ProcessException:` org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 2

I figured it out. I was putting both the "Maven Central/jCenter, add dependency to your build.gradle:" and "JitPack.io, add jitpack.io repositiory and dependency to your build.gradle:" pieces of code. I removed the below code from my build.gradle and it worked fine:
dependencies{
compile 'com.github.lecho:hellocharts-library:1.5.8#aar'
}

Related

Values-ldltr-v21.xml error + AAPT2 Error while trying to build in Android

Long story short, I'm a complete noob in android, bought an app code from codecanyon to use for my next project, I thought it was simple to use since I already did something similar a few weeks back. Anyway while trying to build/test run the app I get the following errors:
C:\Users\username\Documents\MyApp\product\Project\proast\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-ldltr-v21\values-ldltr-v21.xml
Error: file not found.
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
I have no idea what's going on and I tried searching and applying some of the methods I found online and on this site but I think I'm a complete idiot because I can't make it to work.
Here's the build.gradle:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And the build.gradle (module app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.pro.ast"
minSdkVersion 17
targetSdkVersion 26
versionCode 8
versionName "1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.1.0'
//retrofit, gson
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
//firebase
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
compile 'com.google.firebase:firebase-ads:11.6.0'
//glide
compile 'com.github.bumptech.glide:glide:4.3.1'
//circular imageview
compile 'de.hdodenhof:circleimageview:2.1.0'
}
apply plugin: 'com.google.gms.google-services'
I have android studio 3.0.1,
Android SDK installed: 27, 26, 25, 24, 23
java jdk: 1.8.0_144
Any ideas? Would really appreciate it, I guess I will end up refunding the app code in the end since the seller is not responding yet.
Thanks in advance,
Stephen
It is most likely related to AAPT2's limitation with paths on windows. It currently has issues with paths containing non-ascii characters and paths longer than circa 145 characters.
This has been marked as fixed in the android issue tracker, but the fix hasn't been released yet.

During Android Firebase Admob Integration i getting the error Error:Execution failed for task ':app:transformClassesWithDexForDebug'

I'm having trouble while compiling my project and getting the following Exception please help me out.
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 1
my app.build gradle file code is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "my.appid"
minSdkVersion 15
targetSdkVersion 24
versionCode 2
versionName "1.0.1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:palette-v7:24.1.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.firebase:firebase-ads:9.4.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.android.support:multidex:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
And check my project.gradle file code is:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
It looks like you've found a solution to your issue via multidex, but I wanted to point out something about your build settings. In your build.gradle you list these:
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.firebase:firebase-ads:9.4.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
You can take out play-services-ads, as it's included with both firebase-ads and play-services. Also, If the only part of Play services you're using is AdMob, you can actually take out play-services, too.
We recently put up a blog post explaining a bit about what's in each of these artifacts, as well:
Importing the Mobile Ads SDK with Firebase
Hopefully that helps sort things out a little bit!

No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating')

I am getting these two error messages when trying to compile:
/Users/dericw/coding/myApplication/lfdate/android/app/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.2.1/res/values-v23/values-v23.xml
Error:(3, 5) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating').
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/dericw/Library/Android/sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
Android Studio then opens up v23/values-23.xml with this style:
<style name="CardView" parent="Base.CardView">
<item name="cardBackgroundColor">?android:attr/colorBackgroundFloating</item>
</style>
But I don't have that defined anywhere in my app. It is a generated file that is giving me the error. I am pretty stumped on how to fix this issue? Has anyone every encountered this before? How do I fix this?
Project Build File
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}
}
allprojects {
repositories {
jcenter()
}
}
App Build File
buildscript {
repositories {
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 22
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.something.myapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 200
versionName "1.7.1"
}
buildTypes {
debug {
versionNameSuffix '-debug'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
zipAlignEnabled true
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
sourceSets {
androidTest.setRoot('src/test')
}
}
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.crashlytics.sdk.android:crashlytics:2.4.0#aar') {
transitive = true;
}
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile project(':viewPagerIndicator')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.mcxiaoke.volley:library:1.+'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile 'joda-time:joda-time:2.+'
compile 'com.koushikdutta.async:androidasync:2.+'
compile 'com.edmodo:rangebar:1.+'
compile 'org.lucasr.twowayview:twowayview:0.+'
compile 'com.github.amlcurran.showcaseview:library:5.4.+'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.+'
compile 'com.getbase:floatingactionbutton:1.+'
compile 'com.mixpanel.android:mixpanel-android:4.+'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile 'com.wefika:flowlayout:0.+'
compile 'com.hudomju:swipe-to-dismiss-undo:1.+'
compile 'com.soundcloud.android:android-crop:1.0.1#aar'
compile 'com.squareup.picasso:picasso:2.+'
}
apply plugin: 'com.google.gms.google-services'
compile 'com.facebook.android:facebook-android-sdk:4.+' needs V-23
Change the facebook version SDK to 4.8.0 then it won't use that resource file. Then your code will be up & running/
I also had this issue. I solved by forcing an older version of the card view library as the issue is with that.
compile('com.android.support:cardview-v7:23.2.0') {
force = true
}
The issue was with 23.2.1 of card view, the Facebook SDK uses this library.
If you are using the "cordova-plugin-facebook4" plugin, please remove the plugin from your project and pull it again (the latest version), then add it back to your project.
At the same time, please check the xml file, which is locate at yourCordovaProject/plugin/cordova-plugin-facebook4/plugin.xml around line No. 64, it must be 4.8.+ :
<framework src="com.facebook.android:facebook-android-sdk:4.8.+"/>
For a temporary fix I solved my issue changing the project.properties:
vi platforms/android/project.properties
and changed from target=android-22 to target=android-23
For a permanent fix you just need to update the android platform:
cordova platform update android --save
For Phonegap Build users, try this. It worked for me.
<plugin spec="https://github.com/jeduan/cordova-plugin-facebook4#aff9a08a86cc6c6a18019f7adc2896ddf97c11cd" source="git" >
my system already had 23 installed. from project panel, Application -> Open module setting (F4) -> application -> Properties tab. I had Compile Sdk Version Android 5.50 (lollipop). So I changed to API 23+ and it worked.
So I checked Application build.gradle changed
from compileSdkVersion 21
buildToolsVersion "23.0.3"
to
compileSdkVersion 'android-N'
buildToolsVersion "23.0.3"
so I"m guessing you can simply change compoileSdkVersion to your buildTollVersion.
I've fixed it removing the plugin:
cordova plugin remove cordova-plugin-facebook4
And installing it again from this commit:
cordova plugin add https://github.com/jeduan/cordova-plugin-facebook4\#aff9a08a86cc6c6a18019f7adc2896ddf97c11cd --save --variable APP_ID="YOUR_FB_APP_ID" --variable APP_NAME="YOUR_FB_APP_NAME"

Android studio - finished with non-zero exit value 1 exception

I have added Fabric to my application from Android studio via Fabric plugin, after that I could not run my application. It shows following error while running the project.
Error message:
Error:Execution failed for task ':qApp:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 1
build.gradle file after included Fabric:
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.+'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.qapp"
minSdkVersion 14
targetSdkVersion 21
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':facebookSDK')
compile project(':payPalDemo1')
compile project(':uberLibrary')
compile project(':bSLibrary')
compile project(':pullToRefresh')
compile project(':androidmapsutils')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/cardio.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/UserFormValidation.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
}
It was working fine before adding Fabric, how I can resolve this issue? please help me. I am running on Ubuntu Machine.
Try to add multiDexEnabled true in your gradle file as below:
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
...
}
After that clean and rebuild your project.
It's work for me.I hope its helps you.
You app has crossed the dex limit of 65k methods so you need to enable multidex in your app.
add
compile 'com.android.support:multidex:1.0.1'
to gradle and also add multidex:true
defaultConfig {
multiDexEnabled true
}
Also extend your application class with MultiDexApplication.this and this.
*note - you might wanna remove playservices with more bifurcated version like this link explains, to avoid multidex issues.

Android google play services duplicate entry

I'm trying to use google services in my Android app, but I was getting the following error:
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_11\bin\java.exe'' finished with non-zero exit value 2
I was told to try adding multiDexEnabled = true and now the error has changed to this:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/GooglePlayServicesAvailabilityException.class
I looked through my libs but wasn't able to find any conflicts between them.
My jars:
gdata-client-1.0.jar
gdata-client-meta-1.0.jar
gdata-core-1.0.jar
gdata-spreadsheet-3.0.jar
gdata-spreadsheet-meta-3.0.jar
google-play-services.jar
My project gradle file has the following dependencies:
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.google.gms:google-services:1.3.0-beta1'
My module gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.mydomain.myproject"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.google.code.gson:gson:2.3.1'
compile group: 'com.google.guava', name: 'guava', version: '18.0'
}
Any help on fixing these errors would be appreciated.
I looked through my libs but wasn't able to find any conflicts between them
google-play-services.jar would appear to conflict with compile 'com.google.android.gms:play-services:7.5.0'. Remove that JAR and see if that helps.

Categories

Resources