Cordova Android App Build Issue - Duplicate zip entry - java

My AngularJS based Cordova project facing various Android build issues recently. It was in gradle version of 2.14.1 with build tools of 2.2.3. However, faced issue as "A problem occurred configuring root project ".
I tried removing android platform and adding again with platform version 6.4.0,
Recent error While perform Cordova build android:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':transformClassesWithMultidexlistForDebug'.
java.io.IOException: Can't write [/Users////platforms/android/build/intermediates/multi-dex/debug/componentClasses.jar] (Can't read [/Users/****/.gradle/caches/transforms-1/files-1.1/support-v4-23.4.0.aar/21482513ed63a92f167953e0b46db339/jars/classes.jar(;;;;;;.class)] (Duplicate zip entry [classes.jar:android/support/v4/util/ArrayMap.class]))
I tried using multiDexEnabled as true in defaultconfig, but error remains same,
Project.properties :
target=android-26
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-android-support-gradle-release/stcmobile-cordova-android-support-gradle-release.gradle
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.android.support:support-v4:+
cordova.system.library.4=com.android.support:multidex:1.0.1
Build.gradle :
android {
......
defaultConfig {
multiDexEnabled true
}
compileSdkVersion 26
buildToolsVersion '26.0.2'
.......
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
......
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: "CordovaLib"))
compile "com.android.support:support-v4:24.1.1+"
compile "com.android.support:support-v4:+"
compile "com.android.support:multidex:1.0.1"
// SUB-PROJECT DEPENDENCIES END
}
}
I'm not in a position to migrate the application to latest Angular and hence this build related issues needs to be fixed.
current Versions details,
Cordova Android : 6.4
Cordova : 7.1
Gradle : 4.1
com.android.tools.build:gradle : 3.0.0
compileSdkVersion 26
buildToolsVersion '26.0.2'

After multiple trial and check with various compile sdk and build tools versions, the errors got eliminated and still running the project.

Related

Problem to integrate PayU SDK in android studio

I need to integrate into a PayU application for Android, I downloaded the files and integrate it into a new module. When you finish compiling, throw this error.
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
The specified Android SDK Build Tools version (25.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Update Build Tools version and sync project
Open File
Failed to resolve: phonepe.intentsdk.android.release:IntentSDK:0.1.3
Open File
Show in Project Structure dialog
I go to the new module and change it for implementation and Version 28.0.
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 2
versionName "2.0.1"
}
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.payu.custombrowser:payu-custom-browser:7.2.5'
implementation 'com.payu.india:payu-sdk:4.4.5'
implementation 'com.payu.samsungpay:samsungpay:1.0'
implementation 'com.payu.magicretry:magicretry:1.0.6'
implementation 'com.payu.phonepe:phonepe-intent:1.0.0'
and a new problem appears :
Failed to resolve: phonepe.intentsdk.android.release:IntentSDK:0.1.3
Open File
Show in Project Structure dialog
you need to add the repository:
allprojects {
repositories {
maven {
url "https://phonepe.bintray.com/PhonePeIntentSDK"
}
}
}

I can't run an android app because of a seemingly missing unknown parent resource? [duplicate]

I've always programmed Android with Eclipse and decided to start migrating to Android Studio. I decided to use the same SDK I already had for Eclipse, then:
Started a new project
Set minimum SDK 4.0 (API Level 14)
Choose Blank Activity option
Used Default names for Activity Name and Layout Name
Hit Finish
After a few seconds Gradle finishes the build, and it throws me two errors with the following messages in file Teste4\app\build\intermediates/exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v23\values-v23.xml:
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Under File -> Project Structure -> Modules: app (left column) -> Properties tab, I have the following versions set up:
"Compile Sdk Version": Android 5.1 (API Level 22)
"Build Tools Version": 23.0.2
What should I do in order to fix this?
I already tried what was suggested in Stack Overflow question appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable', but it didn't work.
Your compile SDK version must match the support library's major version.
Since you are using version 23 of the support library, you need to compile against version 23 of the Android SDK.
Alternatively you can continue compiling against version 22 of the Android SDK by switching to the latest support library v22.
This happens because after updates Android Studio uses API version 23 by default.
The following worked for me:
Press Ctrl + Shift + Alt + S to get to the project structure page. Go to the properties tab and change 23.0.0 to 22.0.1 (or equivalent to what you were using earlier) in the build tool area and rebuild your project.
If that doesn't work, go to gradle:app and then
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
Edit v7:23.0.0 to v7:22.2.1 as shown above and sync gradle. This will definitely work.
When you update your Android Studio, it uses API version 23 by default,
which is the main reason for its occurrence. So,
At first, check your AppCompat version in build.gradle(Module:app)
That is,
If after changing to 23 there occurs an error then just download
Compile Sdk Version to API 23, and Build Tools Version to 23.0.0
from SDK Manager. If already downloaded then:
1. Go to SDK Manager and
2. Under Project Structure, change *Compile SDK Version* to API 23, and *Build Tools Version* to 23.0.0
Click the SDK Manager Button and open the dialog.
Click SDK Platform and check if Android 6.0 is downloaded or not.
if not, then download that first. After completing the download, click Apply.
Now you need to apply changes to your project from setting.
Then press Ctrl + Alt + Shift + S to open setting
Click the app from the list.
Click properties
Change your Compile SDK Version to API 23
Change your Build Tools Version to 23.0.0
Don't forget to rebuild your project.
Then your error will be gone.
If you've tried to change target to a previous GooglePlayServices or AppCompatv7 version and it doesn't work, check if you have any project-libraries dependency, this project will be targeting the latest version of any of these libraries. It happened to me with the Google Maps Utils Library project:
replace:
compile 'com.google.android.gms:play-services:+'
to
compile 'com.google.android.gms:play-services:8.3.0'
Then you can continue full targeting API 22
If it still doesn't compile, sometimes is useful to set compileSdkVersion API to 23 and targetSdkVersion to 22.
I agree with the previous answer. Your compile SDK version must match the support library. Here is what I did.
You can go to SDK Manager and under SDK Platform, install the Android 5.X with API level 23.
Under Project Structure, change compile SDK Version to API 23, and Build Tools Version to 23.0.0
Then it should build without problem.
You need to set compileSdkVersion to 23.
Since API 23 Android removed the deprecated Apache Http packages, so if you use them for server requests, you'll need to add useLibrary 'org.apache.http.legacy' to build.gradle as stated in this link:
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
...
//only if you use Apache packages
useLibrary 'org.apache.http.legacy'
}
This issue is raised because now the compile SDK version must match the Android Support library's major version.
In my case i have the Android Support Library version 23, so i had to compile against the Android SDK version 23, and I had to change this in my build.gradle file:
Well some of you will need to install the SDK, Android 6.0 (API 23)
and donĀ“t forget to Sync project with gradle files
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId ""
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.1'
}
I found the solution, Problem started when I updated sdk, after that I used different buildToolsVersion ('22.0.1') and I was using different support library like compile 'com.android.support:appcompat-v7:23.0.0', showing you in image below
This was raising problem of "android.widget.Material..."
Then I used same version for support library like compile 'com.android.support:appcompat-v7:22.0.1' and its DONE. (Showing you in below screenshot)
You should compile your project with latest version so update & install from your SDK. Sync your project with sync project with Gradle file Button.
You can also continue with the existing version but check it installed properly below image indicate to API 22 that is properly installed.
And sync your project if needed.
it may help.
As pointed out by Tanis.7x, the support library version (23) does not match the targetSdkVersion (22)
You can fix this by doing the following:
In the build.grade file of your app module, change the following line of code
compile 'com.android.support:appcompat-v7:23.0.0'
To
compile 'com.android.support:appcompat-v7:22.+'
This will use the latest version of the appcompat version that is compatible with SdkVersion 22.
Your compile SDK version must match the support library major version. This is the solution to your problem. You can check it easily in your Gradle Scripts in build.gradle file.
Fx: if your compileSdkVersion is 23 your compile library must start at 23.
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 340
versionName "3.4.0"
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
}
And always check that your Android Studoi has the supported API Level. You can check it in your Android SDK, like this:
In my case it was an higher version of Google-play-services. I set them to 7.0.0 (not 8.x) and all was ok.
I wanted to downgrade from API 23 to 22 and got this error. I had to change all build.gradle files in a project in order to compile.
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.yourapp.app"
minSdkVersion 14
targetSdkVersion 22
}
...
dependencies {
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
}
This is what helped me: Adding specific android platform
What should be done is the following... In my case it was cordova but the same is relevant for ionic, phonegap and other frameworks like these:
list all platforms installed for your project: cordova platform list. You'll see something like this:
remove the android platform: cordova platform remove android.
then add the specific android platform: cordova platform add android#5.0.0.
Good luck! :)
I got the same problems. I solved my problem by updating gradle.build for each sub-module to latest compiler version.
Another solution :
navigate to
\sdk\extras\android\m2repository\com\android\support\appcompat-v7\23.x.x
open .aar file with 7-zip or winrar , in res folder remove values-23 folder and save changes .
on module: app (Gradle)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.namepack.nameappxxxxx"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
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:21.0.3'
}
project: nameAppXXXX (Gradle)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
and edit your activity of AppCompatActivity to for example Activity:
package com.namepack.nameappxxxxx;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
public class NameClass extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
}
}
Everything is great but none of you explained where to download the SDK build tools
Make sure that all these are in upto date.
Upgrade Android Studio.
I had this issue with Android Studio 1.3.1 and none of the other answers worked for me, but after updating to 1.5.1 there were no problems.
If you are using phonegap(cross-platform) and got same issue above,
just remove the android platform using below command.
phonegap platform remove android
And add it again.
phonegap platform add android
Then problem solved for me.
If you are getting errors even after downloading the newest SDK and Android Studio, here is what I did:
Download the most recent SDK
Open file-Project structure (Ctrl + Alt + Shift + S)
In modules, select app
In the properties tab: Change compile SDK version to API 23 Android 6.0 marshmallow (latest)
I hope it helps someone so that he won't suffer like I did for these couple of days.
As others have already mentioned your compile sdk version must match your support library's major version. This is however, also relevant for subprojects should you have any.
In case you do, you can set your subprojects compile sdk versions with the following script:
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
Add this script in your root build.gradle file.

Issue with log4j version 2.9.0 in Android

I am using log4j in one of my Android lib projects. Now I updated the log4j version from 2.3.0 to 2.9.0 and building the lib project is successful and also I was able to successfully add this lib project to my main project as a dependency. But when I run my project, I get the following error.
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 53 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
...while parsing META-INF/versions/9/org/apache/logging/log4j/util/ProcessIdUtil.class
To over come the above error I made the following changes in the gradle.
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
After the above changes I got the following error while running the project.
Error:Jar transformation: class files coming from an unsupported Java
version Error:Execution failed for task
':MyApp:transformClassesWithPreJackPackagedLibrariesForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.core.JackToolchain$ToolchainException: Jack compilation exception
Now I am not getting a proper solution for this problem. Even I raised this in log4j forum (https://issues.apache.org/jira/browse/LOG4J2-2038). But the provided solution doesn't explain much.
Mean while I am trying to work directly with the log4j android code from here .
This has become a blocker for me. Any help will be appreciated. Thanks.

Gradle sync failed: Unable to find method

I try to import a project in Android studio. When importing it, i've got an Error with Gradle :
Gradle sync failed: Unable to find method
'org.gradle.api.artifacts.Configuration.setExtendsFrom(Ljava/lang/Iterable;)Lorg/gradle/api/artifacts/Configuration;'.
I have tried :
Re-download dependencies and sync project: Fail (same error).
Stop Gradle build processes: Fail (same error).
Delete the .graddle in the home directory: Fail (same error).
Invalidate cache and restart Fail (same error).
Uninstall and reinstall Android studio and SDK: Fail (same error).
/build.gradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
/app/build.gradle
apply plugin: 'com.android.application'
//apply plugin: 'android'
android {
compileSdkVersion 17
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'xxx.xxx.xxx'
minSdkVersion 17
targetSdkVersion 17
versionCode 1
versionName '1.0'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
buildPB {
debuggable false
jniDebuggable false
renderscriptDebuggable false
zipAlignEnabled true
}
}
productFlavors {
}
// lintOptions {
// abortOnError false
// }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile ('org.simpleframework:simple-xml:2.7.1') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
compile 'net.sf.opencsv:opencsv:2.3'
compile 'de.greenrobot:greendao:1.3.7'
// You must install or update the Support Repository through the SDK manager to use this dependency.
// compile 'com.android.support:support-v4:19.+'
}
I fixed the error by changing the following things.
Open the file under your-app-project\your-app-name\gradle\wrapper\gradle-wrapper.properties
replace the old URL path by this one:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
Rename the folder name from "...\1.12" to your-app-project\your-app-name\.gradle\2.10
Change the classpath of your-app-project\your-app-name\build.gradle to
classpath 'com.android.tools.build:gradle:2.1.2'
Replace runProguard of your-app-project\your-app-name\app\build.gradle by minifyEnabled
Click Retry on the error reminder or Reopen your Android Studio and project.
I am using the latest versions of Android Studio and Gradle.
edit Project >> App >> gradle >> wrapper >> gradle-wrapper.properties
distributionUrl=http\://services.gradle.org/distributions/gradle-2.10-bin.zip
rebuild the project (restart ide in your mind)
Project >> App >> gradle >> wrapper >> gradle-wrapper.properties
https\://services.gradle.org/distributions/gradle-4.1-all.zip
This will surely work. I was having same issue. Solved by this.
This issue appears when I updated my android studio to 3.1.1
1.
I have resolved it by changing:
classpath 'com.android.tools.build:gradle:3.1.1'
in build.gradle (project)
2.
change:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
in gradle-wrapper.properties.
(you can check it in explorer C:\Program Files\Android\Android Studio\gradle\gradle-4.4)
I faced similar issue and i resolved it by
Android Studio Version 3.0.1
1.Change the classpath of your-app-project\your-app-name\build.gradle to classpath 'com.android.tools.build:gradle:3.0.1'.
2.Replace the old URL path by this one: distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
My gradle file was of version 4.1
ie; file in following location:(may differ slightly in your machine)
C:\Program Files\Android\Android Studio\gradle\gradle-4.1
Under gradle->gradle-wrapper.properties
replacing
distributionUrl=https\\://services.gradle.org/distributions/gradle-2.2.1-all.zip
with
distributionUrl=https\\://services.gradle.org/distributions/gradle-4.1-all.zip
solved the issue.
This issue happened to me today with Android Studio 2.2 Beta2 on Windows 7 64-bit.
None of the solutions mentioned helped. Finally I was able to resolve the issue by re-importing my project.
For me the solution was to open Settings -> Build, Execution, Deployment -> Gradle and check "Use default gradle wrapper (recommended)".
I was able to copy over the /.gradle folder from a new Android project into the one that was having the problem. Then I restarted Android Studio and did a clean/build. This resolved my issue.
After 1 hour R&D Not Solution as worked for me...
But still i have solution follow this its work 100
step 1: upgrade your build.gradle(Project:<your project name>)
Example : classpath 'com.android.tools.build:gradle:2.1.3' // old gradle file
classpath 'com.android.tools.build:gradle:2.3.1' // upgraded file
OR
classpath 'com.android.tools.build:gradle:3.1.0'
Step 2 : Upgrade compileSdkVersion buildToolsVersion
Example : compileSdkVersion 23 buildToolsVersion "23.0.3 // old api's
compileSdkVersion 25 buildToolsVersion "25.0.2" // upgraded api's
Step 3: upgrade gradle-wrapper.properties
Example : distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip // old or any version
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip // new or any version
Step 4 : finally goto build>rebuild project...
......End #Ambilpura
The answer is partially reduntant, but it's for those who are confused with what version of gradle distribution to add.
It's the gradle version that's installed on your machine.
Ex:
Check your gradle version by:
"gradle -v" (mine was 5.4.1)
Update the file "your-app-project\your-app-name\gradle\wrapper\gradle-wrapper.properties" with
distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip
And done! It solved the problem for me.

Importing JDBC into Android Studio errors

I am currently working on an Android app and I am attempting to retrieve information from a MySQL database. I am trying to use JDBC as instructed by my professors, but I keep running into problems.
I have installed the MySQL Connector/ODBC 5.3, set a CLASSPATH environment variable for the driver I am attempting to use, which is "mysql-connector-java-5.1.38-bin.jar", and I attempted to import that JAR into my project.
I have attempted to import the JAR in two ways, which are the following:
File > New Module > Import .JAR/.AAR Package > import the mysql connector JAR
Then I proceeded to go to File > Project Structure > app > Dependencies > add module dependency
The other way I have attempted to do this was by adding the JAR into the "libs" folder of my project and follow the Project structure path to add a dependency from file.
I am running the latest version of Android Studio 2.0
The build completes successfully when following either of the importing steps however when doing so I get the following error when attempting to run the app:
Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
> JSR/RET are not supported with computeFrames option
The only solution I found relevant to this was going to Android Studio Settings and turning the Instant Run option off.
After doing so I received the following error instead:
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_77\bin\java.exe'' finished with non-zero exit value 1
The following is my build.gradle(Module:app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.example.JohnDoe.myapp" //This is not actually the name or the name of the app on there but I changed this for privacy.
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "2048M"
jumboMode = true
}
}
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.2.1'
compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.android.support:multidex:1.0.1'
compile project(':mysql-connector-java-5.1.38-bin')
}
The following is a link to the whole gradle console output after turning "Instant Run" off: pastebin.com/5kj6Cgeb
Please advise me where to go from here to get the JDBC driver working so I can finish this project. Thank you for your time.
UPDATE 1: Apparently the latest JDBC driver is not fully compatible with Android and causes issues. I installed and imported the previous version (5.0.8) and so far the app at least runs. Will be attempting to implement the driver now and actually develop with it, at which time I will post another update on the outcome.
You should not use JDBC in Android Apps as it is targetted to high bandwith, reliable connections to a database server, something you will not achieve on a mobile device. Try to wrap your database in a REST web service instead.
I've read several times that people struggled with using JDBC in Android, it's just not built for beeing used in the Android ecosystem. Not every library is fully compatible with Android, your gradle output suggests that the "dexer" could not convert the jar file to a .dex.
Your provided gradle output show the following error:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
See this question for a possible solution. Ensure you are building with the right Java SDK.

Categories

Resources