I am using Android Studio Chipmunk. I will use Parse in my application. But I am getting such an error. Please help because I could not find it.
I use the ..
id 'com.android.application' version '7.2.0' apply false id 'com.android.library' version '7.2.0' apply false`
JavaVersion.VERSION_1_8
parseVersion = "1.17.3"
implementation "com.parse:parse-android:$parseVersion"
implementation "com.parse:parse-fcm-android:$parseVersion"
Related
I made a Java project in Android Studio, and tried to put a file in Kotlin. But you can see that Android Studio doesn't recognize Kotlin files in the same project that contains Java files. Can anyone help please?
Attached photos explaining better:
https://i.stack.imgur.com/sDNoV.png
https://i.stack.imgur.com/MwWbA.png
Maybe you used Annotation in that class. Add kotlin-kapt plugin in build.gradle/module ,this may fix your problem. You can read this document for more guidence.
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
// id 'kotlin-android-extensions'
id 'kotlin-parcelize' // this instead of kotlin-android-extensions
}
Then sync your project.
I discovered to fix this error.
It has to put the following code in root build.gradle file:
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Thank you very to all that tried to help.
In my application, I want to use firebase Crashlytics and for this, I added below codes into my application.
I added this codes step by step from google document!
I added below codes but when sync application show me an error and not sync project.
Build.gradle (project) :
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'io.fabric.tools:gradle:1.26.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://dl.bintray.com/tapsellorg/maven' }
maven { url 'https://maven.google.com/' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gradle (app) :
dependencies {
implementation 'com.google.android.gms:play-services-base:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
but when added this line apply plugin: 'com.google.gms.google-services' , when click on sync show me below error :
The library com.google.android.gms:play-services-base is being requested by various other libraries at [[11.0.2,11.0.2]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
How can I fix it?
build.gradle Module
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
// add the Firebase SDK for Google Analytics
// The app need this to init in Firebase console
implementation 'com.google.firebase:firebase-analytics:17.2.1'
// Add the Firebase SDK for Crashlytics.
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
build.gradle Project
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta01'
You do not need fabric.io anymore, it is deprecated and will be available until March 31, 2020.
Take a look at this Project
and Video
if after all Firebase doesn't recognize the app, record an exception using this
recordException
in android studio 4.0 and above
project level gradle
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
id 'com.google.gms.google-services' version '4.3.10' apply false // Google Services plugin
// Crashlytics Gradle plugin
id 'com.google.firebase.crashlytics' version '2.8.1' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App level gradle
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:30.3.2')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'
}
I have followed the below steps to achieve adding the Firebase Crashlytics to the project,
1.Get the google-service json file and complete adding project to the firebase follow this link Firebase Console.
2.In project build.gradle file add the below code,
buildscript {
repositories {
maven {
url 'https://maven.fabric.io/public'
}
maven {
url 'https://maven.google.com'
}
}
dependencies {
// Check for v3.1.2 or higher
classpath 'com.google.gms:google-services:4.3.2'
// Add dependency
classpath 'io.fabric.tools:gradle:1.31.2'
}
}
allprojects {
repositories {
maven {
url 'https://maven.google.com'
}
maven {
url 'https://maven.fabric.io/public'
}
}
}
3.Inside the app build.gradle file, add the below code,
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
and in dependencies add,
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
4.Induce the crash to check whether it gets reflected in the console in section crashlytics,
Crashlytics.getInstance().crash();
Hope it helps :)
To enter Firebase Crashlytics the first thing you need to do is follow these simple steps:
In app-> build.gradle:
apply plugin: 'io.fabric'
dependencies {
implementation "com.google.firebase:firebase-core:17.2.0"
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
}
In general build.gradle:
buildscript {
repositories {
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.2' // Crashlytics plugin
}
Obviously after that, insert the json file in your project folder to connect your app to Firebase
To do the first test and evaluate if everything is working properly, you don't need to initialize anything, because Crashlytics has the singleton. So go to the main screen of your app and not to Application (otherwise it won't work), and try this:
Crashlytics.getInstance().crash();
After doing the test, go to your app's Firebase panel and click on the Crashlytics button
Register your android app in firebase console and download google-play-services.json and paste under app in project directory.
Please follow below steps:
In project level build.gradle,add below dependency:
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
In app level build.gradle,add below plugin:
apply plugin: 'com.google.firebase.crashlytics'
In project level build.gradle,add below dependency:
implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
For checking,add below code to crash
Crashlytics.getInstance().crash();
You don't need any dependency or.jar file to add crashlytics in your app just follow below steps and let me know if you face any error.
Add the dependency on Google Analytics for Firebase to your app-level build.gradle file:
implementation 'com.google.firebase:firebase-core:16.0.6'
After this, Declare the com.google.firebase.analytics.FirebaseAnalytics object at the top of your activity:
private FirebaseAnalytics mFirebaseAnalytics;
Then initialize it in the onCreate() method:
// Obtain the FirebaseAnalytics instance.
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
That's it for more info refer to official docs of Firebase on How to integrate crashlytics (https://firebase.google.com/docs/analytics/android/start)
Note : mismatching of firebase libraries can give you gradle compilation errors
in your build.gradle add:
buildscript {
repositories {
// Add Google's Maven repository.
google()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
// ...
// Add the Google Services plugin (check for v3.1.2 or higher).
classpath 'com.google.gms:google-services:4.3.3'
// Add the Fabric Crashlytics plugin.
classpath 'io.fabric.tools:gradle:1.31.2'
}
}
Add your app level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
// Add the Fabric plugin.
apply plugin: 'io.fabric'
dependencies {
// ...
// (Recommended) Add the Google Analytics dependency.
implementation 'com.google.firebase:firebase-analytics:17.2.3'
// Add the Firebase Crashlytics dependency.
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
}
Change min Sdk version to 16 in app level build.gradle.
You can go through this link for detailed description of how to connect to crashlytics http://blogssolutions.co.in/android-app-add-firebase-crashlytics/
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.
Please do not tag this question as duplicate... I did not manage to find a solution on the other posts, especially this one... :(
I have got the following error when I launch my app:
/build/intermediates/res/merged/debug/values-v23/values-v23.xml
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Here is my Gradle at the app level:
android {
compileSdkVersion 22
buildToolsVersion '25.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.tasmanic.radio.fm"
minSdkVersion 14
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:animated-vector-drawable:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile files('libs/libGoogleAnalyticsServices.jar')
compile 'com.google.android.gms:play-services-analytics:10.2.1'
compile 'com.google.android.gms:play-services-ads:10.2.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
compile 'com.google.firebase:firebase-config:10.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
apply plugin: 'com.google.gms.google-services'
At the project level:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
}
}
Note that I want to keep targetSdkVersion equal to 22.
Any idea on how to solve this issue?
Thanks !!!
Google Play services / Firebase 10.2.1 depends on version 24.0.0 of the Android Support Library, which you can see by running gradlew androidDependencies.
This means you must compile with API 24 or higher. That does not mean you have to target API 24 or higher though, as explained in this blog post.
The last version of Google Play services to depend on a v22 version of the Support Library was 8.4.0, which does not include any of the Firebase functionality (introduced in 10.0.0).
try change Widget.Material to Theme.AppCompat in your styles-files, that match api level < 21
As the name of the post implies, I cannot get a basic Hello World Android app to deploy after modifying my Gradle build scripts to include the Google App Engine. Here is my app's build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.tbiegeleisen.myfirstapp"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.13'
}
And here is my project's build.gradle file:
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.13'
}
}
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.13'
compile "javax.servlet:servlet-api:3.0"
compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.13'
}
repositories {
mavenCentral();
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
}
allprojects {
repositories {
mavenCentral()
}
}
I am fairly certain that the script is working on some level, because the first time it ran it took a really long time. During this first time, the plugin was being downloaded. When I comment out all of the Google App Engine stuff, then the Hello World app launches with no problems. I have the feeling that Android Studio is trying execute the plugin, but either a dependency is missing, or I have a configuration problem.
When I run the app, Android Studio will spin for around 5-10 minutes, and the die with this error message:
Execution failed for task ':app:preDexDebug'.
\> com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command 'C:\Program
Files\Java\jdk.1.7.0_80\bin\java.exe'' finished with non-zero exit value 3
I don't know whether this error output will be useful, but I am including it anyway.
My hope is that an Android guru on Stack Overflow will be able to help me with this problem. For reference, I need the App Engine because I plan on using geocoding at a later time. I have already been stuck on this for several days now, and I have tried every resource I could find through Google and Stack Overflow.
I think it has something to do with your dependencies. According to Google App Engine documentation, the supported version of Java servlets is 2.5. I don't think Google App Engine supports version 3.0 yet.
Quoting from Google App Engine Java documentation:
App Engine uses the Java Servlet 2.5 standard for web applications. You provide your app's servlet classes, JavaServer Pages (JSPs), static files and data files, along with the deployment descriptor (the web.xml file) and other configuration files, in a standard WAR directory structure. App Engine serves requests by invoking servlets according to the deployment descriptor.
You have to change your dependency to this:
compile "javax.servlet:servlet-api:2.5"