I was integrating Crashlytics following this article
https://firebase.google.com/docs/crashlytics/get-started
This is my project level gradle
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.2.0'
// Add dependency
classpath 'io.fabric.tools:gradle:1.27.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Define versions in a single place
ext {
// Sdk and tools
minSdkVersion = 16
targetSdkVersion = 28
compileSdkVersion = 28
// App dependencies
supportLibraryVersion = '27.1.1'
sqlbriteVersion = '0.7.0'
rxjavaVersion = '2.0.8'
rxandroidVersion = '2.0.1'
retrofitVersion = '2.3.0'
daggerVersion = '2.11'
playServicesVersion = '16.0.0'
constraintLayoutVersion='2.0.0-alpha2'
roomVersion = '1.0.0'
picassoVersion = '2.5.2'
flexboxVersion = '0.3.2'
firebaseMessagingVersion='17.3.4'
firebaseCoreVersion='16.0.6'
crashlyticsVersion='2.9.8'
}
This is my app level gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.seed.app"
minSdkVersion 17
targetSdkVersion 26
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//dagger
compile "com.google.dagger:dagger:$rootProject.daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"
compile "com.google.dagger:dagger-android:$rootProject.daggerVersion"
compile "com.google.dagger:dagger-android-support:$rootProject.daggerVersion"
implementation 'com.android.support:multidex:1.0.3'
//firebase
implementation "com.google.firebase:firebase-messaging:$rootProject.firebaseMessagingVersion"
implementation "com.google.firebase:firebase-core:$rootProject.firebaseCoreVersion"
// Crashlytics
implementation "com.crashlytics.sdk.android:crashlytics:$rootProject.crashlyticsVersion"
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
This is how I crash my application in the MainActivity.
Crashlytics.getInstance().crash();
I am unable to get any errors in my firebase console and get an error message in the log
2019-01-02 20:36:55.139 21274-21274/com.seed.app E/CrashlyticsCore: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up,
install an Android build tool and ask a team member to invite you to this app's organization.
What has my crashlytics installation gotta do with Fabric?
I was able to get this to work by repositioning the apply plugins in my app gradle to
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
Related
I am trying to add firebase to a existing application which involves adding:
classpath 'com.google.gms:google-services:4.3.3'
as dependency to the project level build.gradle, and adding:
apply plugin: 'com.google.gms.google-services'
as a plugin to the app level build.gradle.
The project that I am building upon is "Sign users in/out and call the Microsoft Graph from an Android app"
https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-android
Project level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: rootProject.file("gradle/versions.gradle")
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:$rootProject.ext.gradleVersion"
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App level build.gradle
apply plugin: 'com.android.application'
allprojects {
repositories {
mavenCentral()
google()
mavenLocal()
maven {
name "vsts-maven-adal-android"
url "https://identitydivision.pkgs.visualstudio.com/_packaging/AndroidADAL/maven/v1"
credentials {
username System.getenv("ENV_VSTS_MVN_ANDROIDADAL_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_ANDROIDADAL_USERNAME") : project.findProperty("vstsUsername")
password System.getenv("ENV_VSTS_MVN_ANDROIDADAL_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_ANDROIDADAL_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
}
}
jcenter()
}
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "[com.*.*]"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
signingConfigs {
debug {
storeFile file("../gradle/debug.keystore")
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "main"
productFlavors {
local {
// To be used with android-complete only.
// So that it could look for the 'local' flavor in Broker projects.
matchingFallbacks = ['local']
}
external {}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:$rootProject.ext.appCompatVersion"
implementation "com.google.android.material:material:$rootProject.ext.materialVersion"
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.volley:volley:1.1.1'
if (findProject(':msal') != null) {
// For developer team only.
localImplementation project(':msal')
externalImplementation 'com.microsoft.identity.client:msal:1.0.+'
} else {
// Downloads and Builds MSAL from maven central.
implementation 'com.microsoft.identity.client:msal:1.0.+'
}
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
Below is versions.gradle
// Variables for entire project
ext {
// SDK
minSdkVersion = 16
automationAppMinSDKVersion = 21
targetSdkVersion = 27
compileSdkVersion = 28
buildToolsVersion = "28.0.3"
// Plugins
gradleVersion = '3.2.1'
androidMavenGradlePluginVersion = "1.4.1"
// Libraries
annotationVersion = "1.0.0"
appCompatVersion = "1.0.2"
browserVersion = "1.0.0"
dexmakerMockitoVersion = "1.4"
espressoCoreVersion = "3.1.0"
gsonVersion = "2.8.5"
junitVersion = "4.12"
legacySupportV4Version = "1.0.0"
localBroadcastManagerVersion = "1.0.0"
materialVersion = "1.0.0"
mockitoCoreVersion = "2.18.3"
mockitoAndroidVersion = "2.18.3"
multidexVersion = "2.0.1"
powerMockVersion = "1.6.6"
nimbusVersion = "5.7"
runnerVersion = "1.2.0"
rulesVersion = "1.2.0"
// TODO: adal automation test app.
supportLibraryVersion = "27.1.+"
adalLegacy = "1.15.0"
}
Error when syncing project
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'.
Caused by: java.lang.NoSuchFieldError: ASCII
at com.android.build.gradle.BasePlugin.checkPathForErrors(BasePlugin.java:1006)
at com.android.build.gradle.BasePlugin.apply(BasePlugin.java:261)
at com.android.build.gradle.AbstractAppPlugin.apply(AbstractAppPlugin.java:122)
at com.android.build.gradle.AppPlugin.apply(AppPlugin.java:43)
I had the same problem. I was able to solve it by using classpath 'com.google.gms:google-services:4.0.0' instead of classpath 'com.google.gms:google-services:4.3.3'. Build this to see another type of error. Then do invalidate cache and restart on Android studio from the File menu. Then on restart, your build should be successful. You might also need to use 'com.google.firebase:firebase-analytics:16.0.0' instead of the current version
I have a problem in the Gradle files. As I have updated the Android Studio I had to update the dependencies as well, but I'm getting unresolved dependencies.
Project gradle:
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'io.fabric.tools:gradle:1.29.0'
classpath 'com.novoda:bintray-release:0.4.1'
classpath 'com.google.gms:google-services:4.1.0'
}
}
allprojects {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
}
app gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.packagename"
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
lintOptions {
disable "ResourceType"
}
}
ext {
googlePlayServicesVersion = "4.2.0"
}
dependencies {
implementation files('libs/icu4j-4_4_2_2.jar')
implementation files('libs/jsoup-1.6.3.jar')
implementation files('libs/ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar')
implementation files('libs/zip4j_1.2.6.jar')
implementation('com.crashlytics.sdk.android:crashlytics:2.9.9#aar') {
transitive = true;
}
implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
// Google
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation'com.google.firebase:firebase-auth:16.1.0'
// Firebase
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.android.gms:play-services-ads:17.2.1'
implementation project(':pdflibrary')
implementation 'com.android.support:support-compat:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:customtabs:27.0.2'
implementation files('libs/junit-4.3.jar')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-flags:16.0.1'
implementation 'com.google.android.gms:play-services-basement:16.0.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
pdfLibrary gradle:
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName '1'
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
}
publish {
userOrg = 'thefinestartist'
groupId = 'com.thefinestartist'
artifactId = 'finestwebview'
publishVersion = '1'
desc = 'Beautiful and customizable Android Activity that shows web pages within an app.'
website = 'https://github.com/TheFinestArtist/FinestWebView-Android'
}
This is the errors I'm getting knowing that min-sdk is set to 24 and I only in the gradle and I have removed it from both manifests (app & pdfLibrary):
I have tried suggestion from other SO questions, but nothing worked.
edit minSdkVersion to 21 instead of 24 in pdfLibrary gradle
an sync project
In the allprojects block you have to add the google() maven repo.
allprojects {
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
}
Creating a Firebase Push Notification application in android studio. i did everything and searched everywhere but i could not get any solution. i am getting this same error again and again. Let me post my Gradle files code. please i desperately need help.
Program type already present: com.google.android.gms.common.AccountPicker
and some times
Program type already present: com.google.android.gms.maps.CameraUpdate
here is my app gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.Package.Myapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 2
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:$rootProject.ext.espressoVersion", {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
compile "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintLayoutVersion"
compile "com.google.firebase:firebase-messaging:$rootProject.ext.gmsVersion"
compile "com.google.android.gms:play-services-vision:$rootProject.ext.gmsVersion"
compile "com.google.android.gms:play-services-maps:$rootProject.ext.gmsVersion"
testCompile "junit:junit:$rootProject.ext.junitVersion"
}
apply plugin: 'com.google.gms.google-services'
And here is my project gradle
// 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.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()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext{
// Sdk and tools
minSdkVersion = 15
targetSdkVersion = 26
compileSdkVersion = 26
buildToolsVersion = '26.0.2'
// App dependencies
gmsVersion = "11.0.0"
supportLibraryVersion = '27.0.2'
guavaVersion = '18.0'
junitVersion = '4.12'
mockitoVersion = '1.10.19'
powerMockito = '1.6.2'
hamcrestVersion = '1.3'
runnerVersion = '0.5'
rulesVersion = '0.5'
espressoVersion = '2.2.2'
constraintLayoutVersion = "1.0.2"
}
its a simple webview wrapper application. and i am trying to implement Firebase push notification service on it.
On your project gradle file try replace this line
classpath 'com.google.gms:google-services:3.0.0'
with this:
classpath 'com.google.gms:google-services:3.2.0'
Also you may try to update these versions:
buildToolsVersion = '27.0.3'
supportLibraryVersion = '27.1.1'
I am using some kotlin classes in an existing Android project(already having realm), the kotlin classes are not using any realm feature, now on runtime I am getting this error
:app:compileDebugKotlin
Using kotlin incremental compilation
:app:compileDebugJavaWithJavac
Destination for generated sources was modified by kapt. Previous value = /home/debu/AndroidStudioProjects/WT_Application/app/build/generated/source/apt/debug
error: Annotation processor '__gen.AnnotationProcessorWrapper_debug_io_realm_processor_RealmProcessor' not found
1 error
:app:compileDebugJavaWithJavac FAILED
:app:copyDebugKotlinClasses SKIPPED
FAILURE: Build failed with an exception.
my app's build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'realm-android'
android {
def globalConfiguration = rootProject.extensions.getByName("ext")
compileSdkVersion globalConfiguration.getAt("androidCompileSdkVersion")
buildToolsVersion globalConfiguration.getAt("androidBuildToolsVersion")
defaultConfig {
applicationId globalConfiguration.getAt("androidApplicationId")
minSdkVersion globalConfiguration.getAt("androidMinSdkVersion")
targetSdkVersion globalConfiguration.getAt("androidTargetSdkVersion")
versionCode globalConfiguration.getAt("androidVersionCode")
versionName globalConfiguration.getAt("androidVersionName")
testInstrumentationRunner globalConfiguration.getAt("testInstrumentationRunner")
/*jackOptions {
enabled true
}*/
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dataBinding {
enabled = true
}
}
dependencies {
def presentationDependencies = rootProject.ext.presentationDependencies
def presentationTestDependencies = rootProject.ext.presentationTestDependencies
def developmentDependencies = rootProject.ext.developmentDependencies
compile presentationDependencies.dagger
compile presentationDependencies.butterKnife
compile presentationDependencies.recyclerView
compile presentationDependencies.cardview
compile presentationDependencies.rxJava
compile presentationDependencies.rxAndroid
compile presentationDependencies.appcompat
compile presentationDependencies.constraintLayout
compile presentationDependencies.design
compile presentationDependencies.retrofit
compile presentationDependencies.gsonconverter
compile presentationDependencies.rxjavaadapter
compile presentationDependencies.glide
compile presentationDependencies.flexbox
compile presentationDependencies.maps
compile presentationDependencies.mapUtils
compile presentationDependencies.pagerIndicator
annotationProcessor presentationDependencies.daggerCompiler
annotationProcessor presentationDependencies.butterKnifeCompiler
provided presentationDependencies.javaxAnnotation
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
androidTestCompile presentationTestDependencies.junit
androidTestCompile presentationTestDependencies.mockito
androidTestCompile presentationTestDependencies.dexmaker
androidTestCompile presentationTestDependencies.dexmakerMockito
androidTestCompile presentationTestDependencies.espresso
androidTestCompile presentationTestDependencies.testingSupportLib
//Development
compile developmentDependencies.leakCanary
compile files('libs/YouTubeAndroidPlayerApi.jar')
}
repositories {
mavenCentral()
}
project build.gradle
apply from: 'buildsystem/dependencies.gradle'
buildscript {
ext.kotlin_version = '1.1.2-4'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath "io.realm:realm-gradle-plugin:3.2.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
ext {
androidApplicationId = 'com.wandertrails'
androidVersionCode = 1
androidVersionName = "1.0"
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
testApplicationId = 'com.wandertrails.test'
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Now can someone kindly figure out what is the reason of this error????
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
And
kapt presentationDependencies.daggerCompiler
kapt presentationDependencies.butterKnifeCompiler
Might fix it.
I have next issue during the project building process: build process just stuck on app:kaptDebugKotlin task.
My root project build.gradle:
apply plugin: "kotlin"
buildscript {
ext.kotlin_version = '1.1.2-2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
ext {
buildToolsVersion = '25.0.2'
supportLibVersion = '25.3.1'
runnerVersion = '0.5'
rulesVersion = '0.5'
espressoVersion = '2.2.2'
archLifecycleVersion = '1.0.0-alpha1'
archRoomVersion = '1.0.0-alpha1'
}
and the app build.gradle itself:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 25
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.test.roomtest"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile "io.reactivex.rxjava2:rxandroid:2.0.1"
compile "android.arch.persistence.room:runtime:${rootProject.archRoomVersion}"
compile "android.arch.persistence.room:rxjava2:${rootProject.archRoomVersion}"
kapt "android.arch.persistence.room:compiler:${rootProject.archRoomVersion}"
}
repositories {
mavenCentral()
}
I tried to use different plugin versions but it didn't help. As for using Room seems it's not a problem because this example builds without problems. Will be very appreciate for any help.
Is this still an issue?
The same problem for me was resolved by just using the newest kotlin - 1.3.60.