I'm currently using Android Studio 3.2.1 and came across an issue I couldn't figure out. I've downloaded an mxparser.jar file from mathparser.org to help me with proper equation output.
Click on the link, download the first option. I extracted the MathParser.org-mXparser-v.4.2.0/bin-only/jdk 1.10/MathParser.org-mXparser-v.4.2.0-jdk.1.10.jar file, renamed it to mxparser.jar and copied to the app\libs folder in the project.
This is a brand new project, so everything else is as is. Here is the code in my app file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.imad.equationtyper"
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation files('libs/mxparser.jar')
}
The project builds just fine, but crashes when I try to execute it and yields this error:
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process (path to file)\app\libs\mxparser.jar
Does anyone know how I can solve this?
I found the solution! So the .zip folder I downloaded off mathparser.org had a whole bunch of .jar files. My suspicion of the .jar file not being compiled with the same JDK version was correct. That said, I used one of the older .jar files and it worked perfectly. Thanks for trying to help!
Related
I'm trying to run my app but this error appears in my terminal. I had some problems with SDK before and I was changing build.gradle file.
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.findProperty("android.compileSdkVersion") as Integer
defaultConfig {
targetSdkVersion findProperty("android.targetSdkVersion") as Integer
minSdkVersion findProperty("android.minSdkVersion") as Integer
applicationId findProperty("android.applicationId")
versionCode findProperty("android.minSdkVersion") as Integer
versionName findProperty("android.versionName")
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}}
dependencies {
implementation 'com.android.support:appcompat-v7:30.0.0'
implementation(name:'projA', ext:'aar')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
If you have some advices, what I can do, please help me with it.
Your problem with code is this line
implementation(name:'projA', ext:'aar')
Now this asks gradle to find for a library that has aar extension . Generally it is located in the libs folder located at your_project_folder/app/libs/projA.aar . If you are sure you need this dependency called projA place it in the directory mentioned above . Or remove that line if you do not need it and gradle sync it.
I am trying to generate a signed apk so I can export my app to the Google Play store. However I keep getting the same error. Is there anything to fix this.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.sean.monacoball"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:12.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services:12.0.1'
}
}
Error in depth :
As per the Google Play services setup guide:
Note: Don't use the combined play-services target. It brings in dozens of libraries, bloating your application. Instead, specify only the specific Google Play services APIs your app uses.
As you're using com.google.android.gms:play-services:12.0.1, you're pulling in every Google Play services library. You should switch to only using the libraries you actually use. This will almost certainly put you under the 64k method limit of a single dex file.
I am working on Android Application using the Fire base Database. All the data stored perfectly on the Fire base.
The Problem comes when I make some changes and close the Application by Forcing android Studio to be Shut Down.
Now When I open Android to built Project It Gives Error of Stream output Folder as Null.
I have searched on Stack Overflow and find an answer with my Error Resemblance but I didn't understand the Answer completely.
Answer Searched
Here is my App Gradle Code
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.usmanali.medicineinvent"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
The dependancies in App Gradle
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-database:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
here is build. Gradle File
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
This problem is just Resolved by Deleting the .Gradle File in the Project Folder.
After .gradle File Deletion;
Built and Clean the Project.
I have been trying to install the jdbc driver in android studio to connect to a mysql database.
I have tried to do it in 2 ways which were already explained on stackoverflow but they don't work anymore. Both times I used the jar-file I got after unzipping the file I downloaded here.
The first way was by copying the jar file into the libs folder and adding it as library with a right-mouse click.
The second try was by following this tutorial: How to Mysql JDBC Driver to android studio.
I can always build my app but when I try to run it on the emulator or on an extern android device I got these errors:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.app.app/com.app.app.LoginScreen}: java.lang.ClassNotFoundException: Didn't find class "com.app.app.LoginScreen" on path: DexPathList[[zip file "/data/app/com.app.app-XrBFCO1PMt-F537ZaZs6PQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.app.app-XrBFCO1PMt-F537ZaZs6PQ==/lib/x86, /system/lib, /vendor/lib]]
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.app.app.LoginScreen" on path: DexPathList[[zip file "/data/app/com.app.app-XrBFCO1PMt-F537ZaZs6PQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.app.app-XrBFCO1PMt-F537ZaZs6PQ==/lib/x86, /system/lib, /vendor/lib]]
This is the build.gradle file with the library installed the second way:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "app"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:support-annotations:27.1.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':mysql-connector-java-8.0.11')
}
Litte sidenote: I know that there is no error in my code because I tested it int he Intellij IDE where I did succeed to install the driver.
I hope anybody of you guys can help me. You would rock!
Copy and Paste the .jar in your folder APP:
YourApp\app\libs
In the Gradle file add:
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
.
.
.
implementation files('libs/YourFILE')
}
Add your class. Well that worked for me.
I am learning android and found this extension really helpful in learning.
I have added an .aar file from project
https://github.com/hbb20/CountryCodePickerProject
from the method i saw on youtube in my sample project, and thankfully did not get any error in complete process.
But when I installed my sample app's apk on phone, it is force closing on all android versions (6.0 and 7.1.1 i have checked). It is giving
Application Error - Unfortunately, the App has stopped
when I click on the picker which is perfectly seen on the screen.
But the issue is only country code picker is not coming on screen and application force closes.
Can you please help me with this.
I would be grateful to you.
I am assuming there is something issue in gradle. Don't know whether I am correct.
Here is the part which I have written in gradle
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.test.app"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
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')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'
compile project(':ccp')
}