KotlinJvmAndroidCompilation with name 'debug' not found - android

I'm trying to update my project to the last gradle, v6.2.2, but I'm facing the next error:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> Cannot query the value of this provider because it has no value available.
> KotlinJvmAndroidCompilation with name 'debug' not found.
My project build.gradle is the next:
buildscript {
ext.gradleToolsVersion = '3.6.1'
ext.kotlinVersion = "1.3.70"
ext.googleServicesVersion = "4.3.3"
ext.butterknifeGradlePluginVersion = "10.2.0"
ext.fabricToolsGradleVersion = "1.31.2"
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url 'https://maven.fabric.io/public'
}
maven { url 'https://jitpack.io' }
}
dependencies {
classpath "com.android.tools.build:gradle:3.6.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.google.gms:google-services:$googleServicesVersion" // Google Services plugin
classpath "com.jakewharton:butterknife-gradle-plugin:$butterknifeGradlePluginVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "io.fabric.tools:gradle:$fabricToolsGradleVersion" // Crashlytics plugin
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
maven { url 'https://jitpack.io' }
maven {
url "http://dl.bintray.com/electronicid/maven/"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my app build is:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'io.fabric'
// Touch Library Versions Here
ext {
kotlinVersion = "1.3.70"
androidxAppcompatVersion = '1.1.0'
corektxAppcompatVersion = '1.2.0'
fragmentktxAppcompatVersion = '1.2.2'
androidxVersion = '1.1.0'
multidexVersion = '2.0.1'
preferenceVersion = '1.1.0'
constraintLayoutVersion = '1.1.3'
retrofitVersion = '2.7.1'
butterknifeVersion = '10.2.1'
okHttpVersion = '4.4.0'
gsonVersion = '2.8.6'
stethoVersion = '1.5.1'
rxJavaVersion = '2.2.15'
rxAndroidVersion = '2.1.1'
lifecycleVersion = '2.2.0'
kotlinCoroutineVersion = '1.3.2'
androidSlidingUpPanelVersion = '4.0.0'
glideVersion = '4.11.0'
stickHeaderGridVersion = '0.9.7'
shimmerLayout = '2.1.0'
videoidSdkVersion = '5.2.1'
ottoEventBusVersion = '1.3.8'
cryptoPrefsVersion = '1.3.2.5'
blurryVersion = '3.0.0'
lottieVersion = '3.3.1'
firebaseCoreVersion = '17.2.3'
firebaseAnalyticsVersion = '17.2.3'
firebaseMessagingVersion = '20.1.2'
firebaseCrashVersion = '16.2.1'
crashlyticsVersion = '2.10.1'
circleimageviewVersion = '3.1.0'
fotoapparatVersion = '2.7.0'
dexterVersion = '6.0.2'
ucropVersion = '2.2.4-native'
commonTextVersion = '1.8'
guavaVersion = '28.1-android'
timberVersion = '4.7.1'
discreteScrollViewVersion = '1.4.9'
slideUpVersion = '2.2.8'
biometricVersion = '1.0.1'
playServicesLocationVersion = '17.0.0'
}
def apikeyPropertiesFile = rootProject.file("apikey.properties")
def apikeyProperties = new Properties()
apikeyProperties.load(new FileInputStream(apikeyPropertiesFile))
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultPublishConfig 'release'
publishNonDefault true
defaultConfig {
applicationId "com.planunnum"
minSdkVersion 21
targetSdkVersion 29
versionCode 7084
versionName '7.4.0'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled = true
// SECRET KEY TO ENCRYPT/DECRYPT SHARED PREFERENCES
buildConfigField("String", "SHA_512_SECURE_KEY", apikeyProperties['SHA_512_SECURE_KEY'])
}
signingConfigs {
release {
storeFile file(keystoreProperties['RELEASE_STORE_FILE'])
keyAlias = keystoreProperties['RELEASE_KEY_ALIAS']
storePassword keystoreProperties['RELEASE_STORE_PASSWORD']
keyPassword keystoreProperties['RELEASE_KEY_PASSWORD']
}
}
buildTypes {
debug {
debuggable true
minifyEnabled false
buildConfigField "boolean", "USE_CRASHLYTICS", "true"
ext.enableCrashlytics = true
buildConfigField "boolean", "USE_MOCKS", "false"
}
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile(
'proguard-android.txt'),
// List additional ProGuard rules for the given build type here. By default,
// Android Studio creates and includes an empty rules file for you (located
// at the root directory of each module).
'proguard-rules.pro'
signingConfig signingConfigs.release
// enable crashlytics
buildConfigField "boolean", "USE_CRASHLYTICS", "true"
ext.enableCrashlytics = true
// Disable mocks
buildConfigField "boolean", "USE_MOCKS", "false"
}
mocks {
debuggable true
minifyEnabled false
buildConfigField "boolean", "USE_CRASHLYTICS", "true"
ext.enableCrashlytics = true // Must be false, but testers are human too :(
buildConfigField "boolean", "USE_MOCKS", "true"
}
}
// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
// Butterknife requires Java 8.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// For Kotlin projects
kotlinOptions {
jvmTarget = "1.8"
}
packagingOptions {
// exclude ARMEABI native so file, ARMEABI has been removed in NDK r17.
exclude "lib/armeabi/**"
}
// Change behaivour to rename apk deployed
applicationVariants.all { variant ->
variant.outputs.all { output ->
def project = "plannum"
def SEP = "_"
def buildType = variant.variantData.variantConfiguration.buildType.name
def versionCode = variant.versionName
def buildCode = variant.versionCode
def date = new Date()
def formattedDate = date.format('ddMMyy_HHmm')
def newApkName = project + SEP + buildType + SEP + versionCode + SEP + buildCode + SEP + formattedDate + ".apk"
outputFileName = new File(newApkName)
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre8:${kotlinVersion}"
implementation "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
// BASE
implementation "androidx.appcompat:appcompat:${androidxAppcompatVersion}"
implementation "androidx.core:core:${corektxAppcompatVersion}"
implementation "androidx.core:core-ktx:${corektxAppcompatVersion}"
implementation "androidx.fragment:fragment-ktx:${fragmentktxAppcompatVersion}"
implementation "androidx.constraintlayout:constraintlayout:${constraintLayoutVersion}"
implementation "androidx.preference:preference-ktx:${preferenceVersion}"
implementation "androidx.biometric:biometric:${biometricVersion}"
implementation "androidx.multidex:multidex:${multidexVersion}"
// TEST
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// BUTTERKNIFE
implementation "com.jakewharton:butterknife:${butterknifeVersion}"
kapt "com.jakewharton:butterknife-compiler:${butterknifeVersion}"
// NETWORK
implementation "com.squareup.retrofit2:retrofit:${retrofitVersion}"
implementation "com.squareup.retrofit2:converter-scalars:${retrofitVersion}"
implementation "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
implementation "com.squareup.okhttp3:okhttp:${okHttpVersion}"
implementation "com.squareup.okhttp3:logging-interceptor:${okHttpVersion}"
implementation "com.google.code.gson:gson:${gsonVersion}"
implementation "com.facebook.stetho:stetho:${stethoVersion}"
implementation "com.facebook.stetho:stetho-okhttp3:${stethoVersion}"
// KOTLIN COROUTINES
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutineVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutineVersion"
// LIFECYCLE VIEWMODEL AND LIVEDATA
implementation "androidx.lifecycle:lifecycle-extensions:${lifecycleVersion}"
implementation "androidx.lifecycle:lifecycle-common-java8:${lifecycleVersion}"
// SLIDING PANELS
implementation "com.github.mancj:SlideUp-Android:${slideUpVersion}"
implementation "com.yarolegovich:discrete-scrollview:${discreteScrollViewVersion}"
implementation "com.github.hannesa2:AndroidSlidingUpPanel:${androidSlidingUpPanelVersion}"
implementation "com.daimajia.swipelayout:library:1.2.0#aar"
// IMAGE LOADER
implementation "com.github.bumptech.glide:glide:${glideVersion}"
kapt "com.github.bumptech.glide:compiler:${glideVersion}"
// STICY HEADERS
implementation "com.codewaves.stickyheadergrid:stickyheadergrid:${stickHeaderGridVersion}"
// SHIMMER LAYOUTS
implementation "io.supercharge:shimmerlayout:${shimmerLayout}"
// VIDEOID
implementation "eu.electronicid.android:video-sdk:${videoidSdkVersion}"
implementation "eu.electronicid.android:videoid-sdk:${videoidSdkVersion}"
// OTTO EVENT BUS
implementation "com.squareup:otto:${ottoEventBusVersion}"
// CRYPTOPREFS TO SAVE/LOAD DATA ON SHAREDPREFERENCES
implementation "com.github.AndreaCioccarelli:CryptoPrefs:${cryptoPrefsVersion}"
// BLURRY LAYOUTS
implementation "jp.wasabeef:blurry:${blurryVersion}"
// LOTTIE FOR LOGO SPLASHSCREEN
implementation "com.airbnb.android:lottie:${lottieVersion}"
// FCM
implementation "com.google.firebase:firebase-core:${firebaseCoreVersion}"
implementation "com.google.firebase:firebase-analytics:${firebaseAnalyticsVersion}"
implementation "com.google.firebase:firebase-messaging:${firebaseMessagingVersion}"
implementation "com.google.firebase:firebase-crash:${firebaseCrashVersion}"
implementation "com.crashlytics.sdk.android:crashlytics:${crashlyticsVersion}"
// CIRCLE IMAGE VIEWS
implementation "de.hdodenhof:circleimageview:${circleimageviewVersion}"
// CAPTURE PHOTOS
implementation "io.fotoapparat:fotoapparat:${fotoapparatVersion}"
// REACTIVE PROGRAMMING RXJAVA & RXANDROID
implementation "io.reactivex.rxjava2:rxjava:${rxJavaVersion}"
implementation "io.reactivex.rxjava2:rxandroid:${rxAndroidVersion}"
// REQUEST PERMISSIONS
implementation "com.karumi:dexter:${dexterVersion}"
// CROPPING IMAGES
implementation "com.github.yalantis:ucrop:${ucropVersion}"
// COMMONS TEXT UTILS
implementation "org.apache.commons:commons-text:${commonTextVersion}"
// GUAVA
implementation "com.google.guava:guava:${guavaVersion}"
// BETTER LOG MESSAGES
implementation "com.jakewharton.timber:timber:${timberVersion}"
// LOCATION
implementation "com.google.android.gms:play-services-location:${playServicesLocationVersion}"
implementation project(path: ':everid-release_2.0')
}
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
Any advice please? Thank you

Remove apply plugin: 'io.fabric' help me, but how return crashlytics...

I've faced the same issue and it turned out that the cause of the issue is the fabric gradle plugin (crashlytics) rather than gradle itself.
Basically, the issue occurs when setting ext.enableCrashlytics = true in your build.gradle file using io.fabric.tools:gradle:1.31.2 fabric plugin.
Workaround
You have to avoid explicitly setting ext.enableCrashlytics to true (false is okay).
For example, you can replace the following code
def enableCrashlytics = // comes from somewhere
ext.enableCrashlytics = enableCrashlytics
by
def enableCrashlytics = // comes from somewhere
if (!enableCrashlytics) {
ext.enableCrashlytics = false
}
The behavior remains the same since crashlytics is enabled by default.
As an alternative, you can revert to using 1.31.0 which works fine, but I'd not recommend doing it since the latest version contains a couple of critical bug fixes.
Also, you can consider migrating to Firebase Crashlytics (currently in beta) since Google is dropping support for Fabric soon and this issue might not get fixed.

Fabric is deprecated use Firebase instead. Refer to this page on how to migrate
https://firebase.google.com/docs/crashlytics/get-started?platform=android

Related

Jetpack Compose Material 3 Error . Could not resolve all files for configuration ':app:debugRuntimeClasspath'

I have Two lines of error when i run the simple Jetpack Compose Material 3 Project
build.gradle(Project:)
buildscript {
ext {
compose_version = '1.3.0-beta02'
core_ktx_version = '1.9.0-rc01'
material3_version = 'material3:1.3.0-beta02'
lifecycle_version = '2.4.1'
activity_compose_version = '1.5.1'
nav_version = "2.5.2"
hilt_version = "2.42"
hilt_nav_fragment = "1.0.0"
lottieVersion = "5.2.0"
timber_version = "5.0.1"
hilt_navigation_compose = "1.0.0"
room_version = "2.3.0-beta02"
kotlin_version = "1.6.21"
}
dependencies {
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
classpath "com.android.tools.build:gradle:4.2.1"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module : )
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
}
android {
compileSdk 33
defaultConfig {
applicationId "com.jetpackcompose.jp1"
minSdk 24
targetSdk 33
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:$core_ktx_version"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material3:$material3_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.activity:activity-compose:$activity_compose_version"
implementation "androidx.compose.compiler:compiler:1.3.1"
implementation 'androidx.appcompat:appcompat:1.6.0-beta01'
// hilt -android
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
// To Integrate Navigation
implementation "androidx.navigation:navigation-compose:$nav_version"
// To use additional extensions of navigation frameworks like hiltViewModel()
implementation "androidx.hilt:hilt-navigation-fragment:$hilt_nav_fragment"
implementation "androidx.hilt:hilt-navigation-compose:$hilt_navigation_compose"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
}
settings.gradle:
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
}
rootProject.name = "jp1"
include ':app'
when i run the project i have an error of :
Execution failed for task ':app:desugarDebugFileDependencies'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find androidx.compose.material3:material3:1.3.0-beta02.
Compose compiler and the other compose dependencies have different releases.
The version androidx.compose.compiler:compiler:1.3.0-beta02 doesn't exist.
You can check it in the google maven repo
You can in any case use the stable version of the module compiler 1.3.1 and all the other compose dependencies at 1.2.1 or 1.3.0-beta02:
buildscript {
ext {
compose_compiler = '1.3.1' //compiler
compose_version = '1.3.0-beta02' //compose dependencies
compose_material3 = '1.0.0-beta02' //material3 release
}
//...
}
and then:
composeOptions {
kotlinCompilerExtensionVersion compose_compiler
}
dependencies {
// beta 1.3.0 releases
implementation "androidx.compose.material:material:$compose_version"
//...
//material3
implementation "androidx.compose.material3:material3:$compose_material3"
}
As described in the documentation the compiler 1.3.x requires kotlin 1.7.10:

Failed to load library from git in androidStudio

I'm trying to barteksc/AndroidPdfViewer in my android project but it fail to load the lib and I can't figure out why... Any Idea?
Here's my config :
build.gradle (:app)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'jacoco'
id 'com.google.gms.google-services'
id 'dagger.hilt.android.plugin'
}
apply plugin: 'kotlin-kapt'
android {
compileSdk 31
defaultConfig {
applicationId "com.github.multimatum_team.multimatum"
minSdk 26
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "com.github.multimatum_team.multimatum.MultimatumTestRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
testOptions {
unitTests {
includeAndroidResources = true
returnDefaultValues = true
}
}
testCoverage {
jacocoVersion = "0.8.7"
}
}
dependencies {
implementation fileTree(dir: "libs", include:["*.jar"])
implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
implementation 'com.google.code.gson:gson:2.8.9'
implementation "androidx.preference:preference-ktx:1.2.0"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
....
testImplementation 'org.mockito:mockito-core:4.4.0'
testImplementation 'com.linkedin.dexmaker:dexmaker-mockito:2.28.1'
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
jacoco.includes = ["com.application.*"]
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
reports {
xml.enabled true
html.enabled true
}
def fileFilter = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'android/**/*.*',
// Exclude Hilt generated classes
'**/*Hilt*.*',
'hilt_aggregated_deps/**',
'**/*_Factory.class',
'**/*_MembersInjector.class'
]
def debugTree = fileTree(dir: "$project.buildDir/tmp/kotlin-classes/debug", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
sourceDirectories.setFrom(files([mainSrc]))
classDirectories.setFrom(files([debugTree]))
executionData.setFrom(fileTree(dir: project.buildDir, includes: [
'outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec',
'outputs/code_coverage/debugAndroidTest/connected/*/coverage.ec'
]))
}
connectedCheck {
finalizedBy jacocoTestReport
}
// Allow references to generated code
kapt {
correctErrorTypes = true
}
build.gradle (project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories{
google()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
classpath("com.google.dagger:hilt-android-gradle-plugin:2.38.1")
}
}
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
error : "Could not resolve com.github.barteksc:android-pdf-viewer:3.2.0-beta.1."
I haven't found why I cannot load a library from github. Do I have to use something like jitpack?
I cannot use maven since the lib doesn't support it.
You can't just link to code in github like that. It needs to be packaged into a library and downloaded in compiled form. You have to use maven or similar repository. Gradle doesn't even know how to download source code from git for a dependency, it only expects packaged code.
I wouldn't use this library in any case. It hasn't been updated in 3 years, and the first line of its readme is that its looking for a new maintainer. And since it has no updates, it didn't find one. I would be vary wary of some random library on github, and doubly wary of one that's not maintained.

How Do I resolve this error Could not get unknown property 'publishedGroupId' for project ':lokdonencrypt' of type org.gradle.api.Project."

I am trying to upload an android library to Jcenter, I have successfully created an account, created a repo, package and version. Now I am modifying the build.gradle files for the module and I keep getting this error
Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'publishedGroupId' for project ':lokdonencrypt' of type org.gradle.api.Project.
How do I resolve this
build.gradle(Module:lokencrypt)
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
android {
compileSdkVersion 29
buildToolsVersion "30.0.2"
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "0.0.1"
publishedGroupId "com.lokdonencryption.lokdonencryptionmodule:lokdonencrypt"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
/* task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
from androidJavadocs.destinationDir
classifier = 'javadoc'
}
task androidSourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}*/
ext {
bintrayRepo = 'maven' // Name of the Bintray repo you created
bintrayName = ' com.lokdonencryption.lokdonencryptionmodule:lokdonencrypt' // Bintray package name
publishedGroupId = 'com.lokdonencryption.lokdonencryptionmodule:lokdonencrypt' // Group ID of the SDK which will be added in implementation line of gradle
artifact = 'lokdonencrypt' // Artifact ID of the SDK which will be added in implementation line of gradle
libraryVersion = '0.0.1' // Version of the library you created in Bintray
libraryName = 'lokdonencrypt' // It is generally the module name
libraryDescription = 'LokDon mobile encryption (ECSMID ) for developers'
siteUrl = 'https://github.com/UncleSamTech/LokdonEncryptionModule'
gitUrl = 'https://github.com/UncleSamTech/LokdonEncryptionModule.git'
developerId = 'cbusiness'
developerName = 'Lokdon'
developerEmail = 'cbusinessforum#gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
//Bintray Credentials
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintrayUsername = properties.getProperty('BINTRAY_USERNAME')
bintrayUserOrg = properties.getProperty('BINTRAY_ORG')
bintrayApiKey = properties.getProperty('BINTRAY_API_KEY')
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'commons-io:commons-io:+'
implementation 'org.apache.commons:commons-io:1.3.2'
implementation 'commons-codec:commons-codec:1.8'
implementation 'com.amazonaws:aws-android-sdk-s3:2.7.+'
implementation 'com.amazonaws:aws-android-sdk-cognito:2.7.+'
}
apply from: 'bintray.script'
build.gradle(Module:app)
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 29
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.lokdonencryption.lokdonencryptionmodule"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "0.0.1"
//publishedGroupId "com.lokdonencryption.lokdonencryptionmodule:lokdonencrypt"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation project(":lokdonencrypt")
implementation 'commons-io:commons-io:+'
implementation 'commons-codec:commons-codec:1.8'
implementation 'org.apache.commons:commons-io:1.3.2'
implementation 'com.amazonaws:aws-android-sdk-s3:2.7.+'
implementation 'com.amazonaws:aws-android-sdk-cognito:2.7.+'
// implementation 'com.amazonaws.util.EncodingSchemeEnum.BASE64'
}
Okay, so I am answering my question. The error is an exception thrown which is a MissingPropertyException which means I didn't add a property
The fix was that I copied this block of code below in the wrong build.gradle file
Before
the code was in the build.gradle file of the new module I created as seen below
ext {
bintrayRepo = 'maven' // Name of the Bintray repo you created
bintrayName = ' com.lokdonencryption.lokdonencryptionmodule:lokdonencrypt' // Bintray package name
publishedGroupId = 'com.lokdonencryption.lokdonencryptionmodule:lokdonencrypt' // Group ID of the SDK which will be added in implementation line of gradle
artifact = 'lokdonencrypt' // Artifact ID of the SDK which will be added in implementation line of gradle
libraryVersion = '0.0.1' // Version of the library you created in Bintray
libraryName = 'lokdonencrypt' // It is generally the module name
libraryDescription = 'LokDon mobile encryption (ECSMID ) for developers'
siteUrl = 'https://github.com/UncleSamTech/LokdonEncryptionModule'
gitUrl = 'https://github.com/UncleSamTech/LokdonEncryptionModule.git'
developerId = 'cbusiness'
developerName = 'Lokdon'
developerEmail = 'cbusinessforum#gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
//Bintray Credentials
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintrayUsername = properties.getProperty('BINTRAY_USERNAME')
bintrayUserOrg = properties.getProperty('BINTRAY_ORG')
bintrayApiKey = properties.getProperty('BINTRAY_API_KEY')
}
To solve it
I simply copied it and put it in the build.gradle file of the project level module and the error disappeared.
Check the snapshot below and see the changes

Class Dependency Is Duplicated "Program type already present"

Error
Program type already present: androidx.versionedparcelable.NonParcelField","sources":[{}],"tool":"D8"}
I Couldn't figure out which entry is duplicated anyone help me to resolve this ? does it cause of Androidx core library ? but i think there is no duplicate entry for androidx core
Project.gradle
buildscript {
ext.kotlinVersion = '1.3.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
ext {
minSdkVersion = 19
targetSdkVersion = 28
buildToolsVersion = '28.0.3'
versionName = '4.5.1'
versionCode_lite = 98
versionCode_plus = 96
}
App.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'jacoco'
apply plugin: 'com.github.ben-manes.versions'
android {
compileSdkVersion project.targetSdkVersion
buildToolsVersion project.buildToolsVersion
defaultConfig {
minSdkVersion project.minSdkVersion
targetSdkVersion project.targetSdkVersion
versionName project.versionName
vectorDrawables.useSupportLibrary = true
}
sourceSets {
lightningPlus.setRoot('src/LightningPlus')
lightningLite.setRoot('src/LightningLite')
}
buildTypes {
debug {
// TODO: debug cannot be used on SDK < 21
multiDexEnabled true
minifyEnabled false
shrinkResources false
proguardFiles 'proguard-project.txt'
testCoverageEnabled true
}
release {
multiDexEnabled true
minifyEnabled true
shrinkResources true
proguardFiles 'proguard-project.txt'
testCoverageEnabled false
}
}
testOptions {
unitTests.all {
jacoco {
// This option needs to be included for robolectric tests
includeNoLocationClasses = true
}
}
}
flavorDimensions "capabilities"
productFlavors {
lightningPlus {
dimension "capabilities"
buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"true\")"
applicationId "acr.browser.lightning"
versionCode project.versionCode_plus
}
lightningLite {
dimension "capabilities"
buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"false\")"
applicationId "acr.browser.barebones"
versionCode project.versionCode_lite
}
}
lintOptions {
abortOnError true
}
packagingOptions {
exclude '.readme'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-v4:26.1.0' // the lib is old dependencies version;
}
}
jacoco {
toolVersion = '0.7.9' // See http://www.eclemma.org/jacoco/
}
dexcount {
includeClasses = false
includeFieldCount = false
format = "tree"
orderByMethodCount = true
verbose = false
}
dependencies {
// test dependencies
testImplementation 'junit:junit:4.12'
testImplementation 'org.assertj:assertj-core:3.11.1'
testImplementation 'org.mockito:mockito-core:2.23.0'
testImplementation 'com.nhaarman:mockito-kotlin:1.6.0', {
exclude group: 'org.jetbrains.kotlin'
}
testImplementation 'org.robolectric:robolectric:3.8'
implementation 'com.android.support:multidex:1.0.3'
// support libraries
implementation "androidx.palette:palette:1.0.0"
implementation "androidx.annotation:annotation:1.0.0"
implementation "androidx.vectordrawable:vectordrawable-animated:1.0.0"
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "com.google.android.material:material:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation "androidx.fragment:fragment:1.0.0"
implementation "androidx.drawerlayout:drawerlayout:1.0.0"
// html parsing for reading mode
implementation 'org.jsoup:jsoup:1.11.3'
// file reading
final def mezzanineVersion = '1.1.1'
implementation "com.anthonycr.mezzanine:mezzanine:$mezzanineVersion"
kapt "com.anthonycr.mezzanine:mezzanine-compiler:$mezzanineVersion"
// dependency injection
final def daggerVersion = '2.17'
implementation "com.google.dagger:dagger:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
compileOnly 'javax.annotation:jsr250-api:1.0'
// view binding
final def butterKnifeVersion = '9.0.0-rc1'
implementation "com.jakewharton:butterknife:$butterKnifeVersion"
kapt "com.jakewharton:butterknife-compiler:$butterKnifeVersion"
// permissions
implementation 'com.anthonycr.grant:permissions:1.1.2'
// proxy support
implementation 'net.i2p.android:client:0.8'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
// rx
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
// tor proxy
final def netCipherVersion = '2.0.0-alpha1'
implementation "info.guardianproject.netcipher:netcipher:$netCipherVersion"
implementation "info.guardianproject.netcipher:netcipher-webkit:$netCipherVersion"
implementation 'com.anthonycr.progress:animated-progress:1.0'
// memory leak analysis
final def leakCanaryVersion = '1.6.1'
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
// kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation 'androidx.core:core-ktx:1.0.0'
}
kapt {
arguments {
arg("mezzanine.projectPath", project.rootDir)
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
kotlinOptions {
jvmTarget = '1.6'
kotlinOptions {
freeCompilerArgs += ['-XXLanguage:+InlineClasses']
freeCompilerArgs += ['-progressive']
}
}
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testLightningPlusDebugUnitTest', 'createLightningPlusDebugCoverageReport']) {
reports {
xml.enabled = true
html.enabled = true
}
final def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
final def debugTree = fileTree(dir: "$buildDir/intermediates/classes/lightningPlus/debug", excludes: fileFilter)
final def kotlinDebugTree = fileTree(dir: "$buildDir/tmp/kotlin-classes/lightningPlusDebug", excludes: fileFilter)
final def mainSrc = "${project.projectDir}/src/test/java"
sourceDirectories = files([mainSrc])
classDirectories = files([debugTree], [kotlinDebugTree])
executionData = fileTree(dir: "$buildDir", includes: [
"jacoco/testLightningPlusDebugUnitTest.exec",
"outputs/code-coverage/connected/*coverage.ec"
])
}
Gradle.properties
kotlin.incremental=false
android.useAndroidX=true
android.enableJetifier=true
android.debug.obsoleteApi=true

No such property: betaDistributionApkFilePath while building with crashlytics

Today I updated to the latest version of crashlytics which was not updated from a very long time.
I am getting the below error while building the file.
Error:No such property: betaDistributionApkFilePath for class:
java.lang.String
I am not setting any betaDistributionApkFilePath property in my gradle file.
This happened after I updated it to the latest version by following the instructions given on the fabric's website. I tried down grading it to a bit older version, but no help. I also, tried to found out more about the error, but it seems that I am the first to face this.
my project level build.gradle
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
all*.exclude group: 'com.google.android.gms', module: 'play-services'
}
buildscript {
ext {
// root project
androidGradleVersion = "3.0.1"
googleServices = "3.2.0"
crashlytics = "1.25.1"
}
repositories {
jcenter()
mavenCentral()
google()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "com.android.tools.build:gradle:$androidGradleVersion"
classpath "com.google.gms:google-services:$googleServices"
classpath "io.fabric.tools:gradle:$crashlytics"
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And this is my App level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
ext {
// android
playService = "11.4.2"
supportLibrary = "27.0.2"
constrainLayout = "1.0.2"
// libraries
retofit = "1.9.0"
okHttp = "2.0.0"
eventBus = "1.3.8"
picasso = "2.5.2"
calligraphy = "2.3.0"
socketIo = "0.3.0"
facebook = "4.30.0"
circularReveal = "1.3.1"
imageCropper = "1.2.2"
expandableRecyclerView = "2.1.1"
crashlytics = "2.9.0"
selectableBackgroudImageView = "1.0.1"
multidex = "1.0.1"
}
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "myappid"
minSdkVersion 16
targetSdkVersion 21
versionCode 01
versionName "01"
multiDexEnabled true
}
buildTypes {
debug {
resValue "string", "app_name", "MyApp Dev"
applicationIdSuffix ".debug"
}
release {
resValue "string", "app_name", "MyApp"
zipAlignEnabled true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "6g"
}
sourceSets {
main {
res.srcDirs = ['src/main/res', 'src/main/res/anim-v21']
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation "com.google.firebase:firebase-database:$playService"
implementation "com.google.firebase:firebase-auth:$playService"
implementation "com.google.firebase:firebase-core:$playService"
implementation "com.google.firebase:firebase-messaging:$playService"
implementation "com.google.android.gms:play-services-cast:$playService"
implementation "com.google.android.gms:play-services-gcm:$playService"
implementation "com.google.android.gms:play-services-analytics:$playService"
implementation "com.google.android.gms:play-services-maps:$playService"
implementation "com.google.android.gms:play-services-location:$playService"
implementation "com.google.android.gms:play-services-auth:$playService"
implementation "com.squareup.retrofit:retrofit:$retofit"
implementation "com.squareup.okhttp:okhttp-urlconnection:$okHttp"
implementation "com.squareup.okhttp:okhttp:$okHttp"
implementation "com.squareup:otto:$eventBus"
implementation "com.squareup.picasso:picasso:$picasso"
implementation "com.android.support:support-v4:$supportLibrary"
implementation "com.android.support:recyclerview-v7:$supportLibrary"
implementation "com.android.support:design:$supportLibrary"
implementation "com.android.support:appcompat-v7:$supportLibrary"
implementation "com.android.support:cardview-v7:$supportLibrary"
implementation "com.android.support:mediarouter-v7:$supportLibrary"
implementation "com.android.support.constraint:constraint-layout:$constrainLayout"
implementation "uk.co.chrisjenx:calligraphy:$calligraphy"
implementation "com.github.nkzawa:socket.io-client:$socketIo"
implementation "com.facebook.android:facebook-android-sdk:$facebook"
implementation "com.facebook.android:facebook-login:$facebook"
implementation "com.github.ozodrukh:CircularReveal:$circularReveal"
implementation "com.theartofdev.edmodo:android-image-cropper:$imageCropper"
implementation "com.bignerdranch.android:expandablerecyclerview:$expandableRecyclerView"
implementation("com.crashlytics.sdk.android:crashlytics:$crashlytics#aar") {
transitive = true
}
implementation "com.joooonho:selectableroundedimageview:$selectableBackgroudImageView"
implementation "com.android.support:multidex:$multidex"
}
apply plugin: 'com.google.gms.google-services'
Below lines in your app level build.gradle is causing the issue.
ext {
// android
playService = "11.4.2"
supportLibrary = "27.0.2"
constrainLayout = "1.0.2"
// libraries
retofit = "1.9.0"
okHttp = "2.0.0"
eventBus = "1.3.8"
picasso = "2.5.2"
calligraphy = "2.3.0"
socketIo = "0.3.0"
facebook = "4.30.0"
circularReveal = "1.3.1"
imageCropper = "1.2.2"
expandableRecyclerView = "2.1.1"
crashlytics = "2.9.0"
selectableBackgroudImageView = "1.0.1"
multidex = "1.0.1"
}
Declare it inside buildScript{} in project level build.gradle
buildscript {
ext {
crashlytics = '2.9.0'
}
}
And for accessing these variables inside app level build.gradle, use like this
compile("com.crashlytics.sdk.android:crashlytics:$rootProject.ext.crashlytics#aar") {
transitive = true
}
Hope this helps...

Categories

Resources