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.
Related
So I am currently trying to store user details into a database, however the program does not mention any errors upon execution, but the application keeps on crashing when trying to open it. This is my error code in logcat:
Code gist will be provided upon request
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.finalyearprojectapp"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-firestore:22.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
try adding multidex support
defaultConfig {
// Your previous stuffs
multiDexEnabled true
}
for more info you can visit this thread. This can be helpful too: https://stackoverflow.com/a/39831657/7237222
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!
I am trying to use Trusted Web Activity, following this guide : https://developers.google.com/web/updates/2017/10/using-twa
I did follow all the steps, but there are several words Android Studio cannot resolve by itself and I do not find any solution. The main problem seems to be org.chromium .
In bold the words it can't resolve :
in TwaSessionHelper.java :
import org.chromium.customtabsclient.shared.ServiceConnection;
import org.chromium.customtabsclient.shared.ServiceConnectionCallback;
...
public class TwaSessionHelper implements ServiceConnectionCallback
{
...
mConnection = new ServiceConnection(this);
in TwaLauncherActivity.java :
setContentView(R.layout.activity_twa_launcher);
and in the few lines of code :
TwaSessionHelper.TwaSessionCallback twaSessionCallback = mTwaSessionCallback.get();
What am I missing ?
Here is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "didi.a8bitpocketwrestlers"
minSdkVersion 17
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:customtabs:28.+'
}
Android Studio cannot resolve ServiceConnectionCallback class because a com.android.support:customtabs library does not contain/provide it. This class exists only in this GitHub repository and no any maven repository. So you not able to add a dependency on it in your build.gradle file, you have to download it and add it in your project manually.
From this GitHub repository download only shared directory, add it in your project as a module.
In your application build.gradle file add a dependency on the shared module.
compile project(':shared')
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'm getting this ERROR message.
Could not find method implementation() for arguments [project ':app']
on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Here's my project level's gradle file :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url "https://maven.google.com" }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
dependencies {
implementation project(':app')
}
Here's my app's gradle file :
apply plugin: 'com.android.application'
apply plugin: 'java-library'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.therationalbloke.myapplication"
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation project(':app')
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'
}
NOTE : I'm already aware of the following.
The "compile" has been replaced by "implementation" in Gradle 3.0 or
higher.
Yes, I'm using Android Studio's latest version and according to Rob, I should prefer the old one. But the thing is that I was haunted
by a lot of technical issues in that version (a lot of them included
stuff which is now outdated).
I've read almost every solution to this problem on Stack Overflow, Github. All of them are either asking to use implementation() instead
of compile (which I'm already using), or they're asking to check if
the Gradle version is 3.0+.
I've tried changing all the "implementation" to "compile" on suggestion of one user on Stackoverflow.
I've tried importing a lot of libraries as suggested by a lot of people in different communities.
Some info about my Android Studio
Android Studio - 3.1.3
Android Plugin Version - 3.1.3
Gradle Version - 4.4
Screenshot of the situation
I've never seen something like implementation project(':app') on a gradle file.
Here you have an example of a working gradle file, try deleting implementation project(':app') and resync.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.amvt_notebook4.codigoqrtest"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
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:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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:10.0.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation files('build/libs/mail.jar')
implementation files('build/libs/additionnal.jar')
implementation files('build/libs/activation.jar')
implementation files('build/libs/jtds-1.3.1.jar')
implementation 'com.android.support:multidex:1.0.3'
}