Fabric "crashlyticsUploadDistributionDebug" is not there - android

I have just updated a project to have debug and release buildTypes, all working well till now expect the crashlyticsUploadDistributionDebug task is not in the project and all other crashlytics tasks are there
using fabricPlugin : '1.28.1'
Task 'crashlyticsUploadDistributionDebug' not found in root project
crashlyticsStoreDeobsDebug
crashlyticsStoreDeobsRelease
crashlyticsUploadDeobsDebug
crashlyticsUploadDeobsRelease
crashlyticsUploadDistributionRelease
android project build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.github.ben-manes.versions'
apply from: '../coverage.gradle'
android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools
defaultConfig {
applicationId 'xxxxxxxxxxxxxx'
versionCode buildInfo.number
versionName buildInfo.name
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
//Fabric
ext.betaDistributionReleaseNotes = buildInfo.releaseNotes
ext.betaDistributionGroupAliases = "xxxxxxxxxxxxxx"
}
buildTypes {
debug {
ext.enableCrashlytics = false
signingConfig signingConfigs.debug
applicationIdSuffix '.debug'
versionNameSuffix '-debug'
}
release {
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
xxxxxx
implementation(libraries.crashlytics) {
transitive true
}
xxxxx
}
apply plugin: 'com.google.gms.google-services'

I found there is property in the debug build type set to false
debug {
...
ext.enableCrashlytics = false
...
}
when removed or switched to true the debug task will be available :|
sorry my bad

Related

How can I rewrite build.gradle files when I use Android Studio Chipmunk?

I create an project based the wizard Empty Compose Activity of Android Studio Chipmunk | 2021.2.1 Patch 1, and the wizard generate two build.gradle files, you can see Code A and Code B.
Code C and Code D are two build.gradle files from an old project.
1: What does apply false in id 'com.android.library' version '7.2.0' apply false of Code A mean?
2: I find that the plugins section exist both Code A and Code B which have almost the same code, why?
3: I find there is a dependencies section in Code C, is it obsolete ?
4: Is repositories section in Code C obsolete ?
Code A: Sample build.gradle (Project)
buildscript {
ext {
compose_version = '1.1.0-beta01'
}
}
plugins {
id 'com.android.application' version '7.2.0' apply false
id 'com.android.library' version '7.2.0' apply false
id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
}
Code B: Sample build.gradle (Module)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "info.dodata.myapplication"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.compose.ui:ui:$compose_version"
...
}
Code C: My build.gradle (Project)
buildscript {
ext {
compose_version = '1.2.0'
hilt_version = '2.42'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
}
}
Code D: build.gradle (Module)
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'kotlin-parcelize'
}
android {
compileSdk 32
flavorDimensions "default"
namespace 'info.dodata.soundmeter'
defaultConfig {
applicationId "info.dodata.soundmeter"
minSdk 23
targetSdk 32
versionCode 3
versionName "1.03"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
allWarningsAsErrors = false
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
...
Android Studio Chipmunk creates a different structure for Gradle files, with a settings.gradle for repositories and a build.gradle (project level) for plugins. In short, this new structure just makes the Gradle files cleaner.
With Gradle is common to see 2 (or more) ways to do the same thing. Comparing code A with code C is the perfect example. Both codes do the same thing but with a different structure in code and file.
Now talking about apply false, it's basically literally. You declare a plugin, with a version, and say to not apply it immediately (in entire project, since it's a build.gradle from project). But you apply what you need only in the module that you are going to use this plugin, for example, in the build.gradle from app module.
You can take a look here for a complete description.
Back to the "new structure" generated by Android Studio with plugins, sometimes you will need to create a dependencies block inside buildscript to use the "old" classpath instead a plugin id because currently not all libraries have the plugin to be used.

No signature of method: build_9oqkz1yq0b57t4arqvsiar91y.android() is applicable for argument types:

I am trying to add firestore to my note app to store my notes and when I run it this error comes:
Build file '~/StudioProjects/noteapp/android/app/build.gradle' line: 29
* What went wrong:
A problem occurred evaluating project ':app'.
> No signature of method: build_9oqkz1yq0b57t4arqvsiar91y.android() is applicable for argument types: (build_9oqkz1yq0b57t4arqvsiar91y$_run_closure2) values: [build_9oqkz1yq0b57t4arqvsiar91y$_run_closure2#2d8103c5]
This is my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.example.noteapp"
minSdkVersion 16
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
multiDexEnabled true
signingConfig signingConfigs.debug
minifyEnabled false
useProGaurd false
shrinkResources false
}
}
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:28.4.0')
implementation 'com.google.firebase:firebase-analytics'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
How do I solve this? Tell me if you need my main.dart as well.
EDIT: It got solved by this:
Gradle DSL method not found: 'runProguard'
I just had to remove this line from my build.gradle:
buildTypes {
release {
multiDexEnabled true
signingConfig signingConfigs.debug
minifyEnabled false
//useProGaurd false
shrinkResources false
}
}
Useprogaurd:false
I got the idea from this and from #gtxtreme:
Gradle DSL method not found: 'runProguard'

Android Studio Canary 3.4 Canary 4 : ERROR: variant.getApplicationId() is not supported by feature plugins

Since I updated my project on the new Android Studio 3.4 Canary 4, the gradle sync failed because:
ERROR: variant.getApplicationId() is not supported by feature plugins as it cannot handle delayed setting of the application ID. Please use getApplicationIdTextResource() instead.
Affected Modules: base
I was previously on Canary 3 and it worked perfectly.
The project is a multi feature app including an instant-app.
Gradle version is gradle-5.0-milestone-1-all
My project level build.gradle
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0-alpha04'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha07'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
compileSdkVersion = 28
minSdkVersion = 16
targetSdkVersion = 28
appVersionCode = 5
appVersion = "2.0.0-dev01"
}
base build.gradle
apply plugin: 'com.android.feature'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco'
apply plugin: 'androidx.navigation.safeargs'
android {
def yo = rootProject
compileSdkVersion yo.compileSdkVersion
baseFeature true
defaultConfig {
minSdkVersion yo.minSdkVersion
targetSdkVersion yo.targetSdkVersion
versionCode yo.appVersionCode
versionName yo.appVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
multiDexEnabled true
}
buildTypes {
debug {
testCoverageEnabled !project.hasProperty('android.injected.invoked.from.ide')
multiDexKeepFile file('multidex-config.txt')
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
multiDexKeepFile file('multidex-config.txt')
}
}
dataBinding {
enabled = true
}
lintOptions {
disable "InvalidPackage"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
repositories {
mavenCentral()
google()
}
dependencies {
application project(':app')
feature project(':module1')
[...]
}
app build.gradle
apply plugin: 'com.android.application'
android {
def yo = rootProject
compileSdkVersion yo.compileSdkVersion
defaultConfig {
applicationId "com.package.name"
minSdkVersion yo.minSdkVersion
targetSdkVersion yo.targetSdkVersion
versionCode yo.appVersionCode
versionName yo.appVersion
multiDexEnabled true
}
buildTypes {
debug {
applicationIdSuffix ".dev"
splits.abi.enable = false
splits.density.enable = false
aaptOptions.cruncherEnabled = false
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation project(':module1')
implementation project(':base')
implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
I tried to sync my project without dependencies but it doest work too.
I also tried to invalidate caches and restart but no effects.
According to the error log, the problem is in the base build.gradle file but I have no idea what is the problem.
Thank you in advance for your help!
Ok I founded the problem.
This is the safe args navigation plugin thats failed.
apply plugin: 'androidx.navigation.safeargs'
If I remove this line, the project is able to sync but not to build cause to classes missing from navigation safeargs.
There is a bug in the navigation plugin in Android Studio 3.4 Canary 4 applied in a baseFeature build.gradle file.
I will post a new question for that.
For anyone who have a similar issue make sure all dependencies in your project-level build.gradle are up-to-date.
For example, I had this issue when my version of google-services plugin was outdated:
buildscript {
repositories {
...
}
dependencies {
...
classpath 'com.google.gms:google-services:4.0.1'
}
}
After updating to the latest version the issue was resolved:
buildscript {
repositories {
...
}
dependencies {
...
classpath 'com.google.gms:google-services:4.2.0'
}
}

Android Studio 3.0 Proguard using kotlin & greendao returns ClassLookupException

The full exception is:
Error:java.lang.RuntimeException: java.lang.RuntimeException: com.android.build.gradle.shrinker.ClassLookupException: Invalid class reference: java/rmi/server/RemoteStub
Error:java.lang.RuntimeException: com.android.build.gradle.shrinker.ClassLookupException: Invalid class reference: java/rmi/server/RemoteStub
Error:com.android.build.gradle.shrinker.ClassLookupException: Invalid class reference: java/rmi/server/RemoteStub
I am using Kotlin and GreenDao.
My gradle:
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion 19
targetSdkVersion 25
versionCode 4
versionName "0.0.0.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
buildTypes.each {
it.buildConfigField 'String', 'GreenDAODatabaseName', '"App_Database"'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
The second gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.2-4'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
All I did so far in the application is add a few UI classes (fragment and activity) written in kotlin.
Two entities exist for greenDAO. Before I added kotlin proguard worked flawlessly.
GreenDAO doesn't support Kotlin yet (see this).
Have you tried this order?
apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'kotlin-android'
Like deviant-studio said here

Gradle: passing parameters to `apply from: <file>`

I'd like to put some common boilerplate gradle script code into shared .gradle file. Then, I can reuse it using apply from: statement.
The question is whether it's possible to pass parameters to applied script?
For example, I'd like to reuse the following boiler plate:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'org.robolectric'
configurations {
apt
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
The problem is here: apply plugin: 'com.android.application'. I'd like to reuse this code either for application projects or android library projects. So I need some parameter in order to decide which plugin to apply:
// assuming <isApplicationProject> - is a script parameter
if (isApplicationProject) {
apply plugin: 'com.android.application'
} else {
apply plugin: 'com.android.library'
}
Of course, I can just define some project-level property in this particular case, but I'd like to know whether it's possible to pass parameters upon script invocation
apply from: is line include<> you cannot pass parameters.
however it does run on the same context and therefor on the same project, so you can do something of:ext.isUsingApp=true; apply from: 'xxx'
if that's the only difference i would advise you to do something of the following:
myinclude.gradle:
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'org.robolectric'
configurations {
apt
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
then in your build.gradle app:
apply plugin: 'com.android.application'
apply from: '../includes/myinclude.gradle'
then in your libs build.gradle:
apply plugin: 'com.android.library'
apply from: '../includes/myinclude.gradle'
for a simple Boolean no need to create parameter.

Categories

Resources