Autocomplete or Code Analyzer not working in Android Studio - android

I am currently working on recyclerview adapter. I can not work further because my autocomplete/code analyzer is apparently not working. I need it to generate the implementation of Recyclerview.Adapter automatically. please help me..
I have a hunch that the problem was caused by my gradle configuration. FYI, everything works fine before i resync my gradle (module). here is my current gradle configuration:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.toharifqi.myfavoritesports"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation "androidx.constraintlayout:constraintlayout:$constraint_version"
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "com.github.bumptech.glide:glide:$glide_version"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
kapt "androidx.room:room-compiler:$room_version"
androidTestImplementation "androidx.room:room-testing:$room_version"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation "com.squareup.okhttp3:logging-interceptor:$logging_interceptor_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "org.koin:koin-core:$koin_version"
implementation "org.koin:koin-android:$koin_version"
implementation "org.koin:koin-android-viewmodel:$koin_version"
}
and this is my gradle configuration for project level:
buildscript {
ext.kotlin_version = "1.4.10"
ext.appcompat_version = "1.1.0"
ext.core_ktx_version = "1.3.2"
ext.constraint_version = "2.0.4"
ext.legacy_support_version = "1.0.0"
ext.junit_version = "4.13.1"
ext.androidx_junit_version = "1.1.2"
ext.espresso_version = "3.3.0"
ext.multidex_version = "2.0.1"
ext.cardview_version = "1.0.0"
ext.recyclerview_version = "1.1.0"
ext.material_version = "1.2.1"
ext.glide_version = "4.12.0"
ext.room_version = "2.2.5"
ext.retrofit_version = "2.9.0"
ext.logging_interceptor_version = '4.9.0'
ext.kotlin_coroutines_version = "1.3.9"
ext.lifecycle_version = "2.2.0"
ext.koin_version = "2.1.6"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
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 {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

I have just found the problem, it was caused by my android core ktx version. previously it was implementation 'androidx.core:core-ktx:1.5.0'. After I changed to implementation 'androidx.core:core-ktx:1.3.2' everything works fine. thank you

Related

Failed to add navigation dependency

I am trying to Add Navigation in my project but its showing failed to add Navigation dependency,
when i click on 'ok' in the window to add these now , its showing failed to add dependency and my navigation xml editor is not visible
here are some screen shots
my build.gradle (app) :-
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'com.google.gms.google-services'
id 'kotlin-android-extensions'
}
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.choudhary.myshop"
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
androidExtensions {
experimental = 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{
viewBinding = true
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-auth-ktx:21.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation platform('com.google.firebase:firebase-bom:29.0.4')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation platform('com.google.firebase:firebase-bom:29.0.0')
implementation 'com.google.firebase:firebase-firestore'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation 'com.google.firebase:firebase-storage-ktx'
def lifecycle_version = "2.5.0-alpha01"
def arch_version = "2.1.0"
// ViewModel
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
// ViewModel utilities for Compose
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version")
// LiveData
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version")
def nav_version = "2.4.0"
// Kotlin
implementation("androidx.navigation:navigation-fragment-ktx:$nav_version")
implementation("androidx.navigation:navigation-ui-ktx:$nav_version")
// Feature module Support
implementation("androidx.navigation:navigation-dynamic-features-fragment:$nav_version")
// Testing Navigation
androidTestImplementation("androidx.navigation:navigation-testing:$nav_version")
// Jetpack Compose Integration
implementation("androidx.navigation:navigation-compose:2.5.0-alpha01")
}
my build.gradle (project ) :-
buildscript {
ext.kotlin_version = "1.4.32"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Seems like Navigation with version 2.3.6 - 2.4.* shows that problem
You can change only
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.0'
to
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
delete all navigation dependency related , and add this :
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
Add 2.3.4 instead of 2.3.5/2.5.3
It's working...

Why my Gradle is showing Read Time out after adding Realm Database

I just add Realm Database in my Project. But now my Gradle giving me error "Read Time out"
Below I'm showing full error image.
I'm Following Realm Documentation as they mention but still getting Error.
Please help me I'm trying to resolve this issue but didn't get any single issue related to this
build.gradle(Project)
buildscript {
repositories {
maven {
url 'https://jitpack.io'
}
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "io.realm:realm-gradle-plugin:10.9.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module)
plugins {
id 'com.android.application'
id 'realm-android'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.app.model_farming"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
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
}
buildFeatures {
viewBinding true
}
}
realm {
syncEnabled = true
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.google.code.gson:gson:2.8.8'
implementation 'com.squareup.okhttp3:logging-interceptor:4.3.1'
// Meow Bottom Navigation Bar -- Not to Update
implementation 'com.etebarian:meow-bottom-navigation:1.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.32"
//OTP PinView
//Loading Bar
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
//Shimmer
implementation 'com.facebook.shimmer:shimmer:0.5.0'
// Lottie dependency
def lottieVersion = "3.4.0"
//noinspection GradleDependency
implementation "com.airbnb.android:lottie:$lottieVersion"
implementation 'com.evrencoskun.library:tableview:0.8.9.4'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
}
on build.gradle(Module) , add (id 'kotlin-kapt') before (id 'realm-android')
plugins {
id 'com.android.application'
id 'kotlin-kapt'
id 'realm-android'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.app.model_farming"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
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
}
buildFeatures {
viewBinding true
}
}
realm {
syncEnabled = true
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.google.code.gson:gson:2.8.8'
implementation 'com.squareup.okhttp3:logging-interceptor:4.3.1'
// Meow Bottom Navigation Bar -- Not to Update
implementation 'com.etebarian:meow-bottom-navigation:1.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.32"
//OTP PinView
//Loading Bar
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
//Shimmer
implementation 'com.facebook.shimmer:shimmer:0.5.0'
// Lottie dependency
def lottieVersion = "3.4.0"
//noinspection GradleDependency
implementation "com.airbnb.android:lottie:$lottieVersion"
implementation 'com.evrencoskun.library:tableview:0.8.9.4'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
}

Could not find android.arch.navigation:navigation-safe-args-gradle-plugin:2.3.5.?

I am using android navigation components but it is giving an error A problem occurred configuring root project 'AndroidCodingChallenge'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find android.arch.navigation:navigation-safe-args-gradle-plugin:2.3.5.
Searched in the following locations:
below my app.gradle
plugins {
id 'com.android.application'
id 'kotlin-android'
}
apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: 'kotlin-kapt'
apply from: '../commons.gradle'
android {
compileSdkVersion 30
buildFeatures {
dataBinding = true
// for view binding:
// viewBinding = true
}
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.androidcodingchallenge"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables{
useSupportLibrary = true
}
multiDexEnabled 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 = JavaVersion.VERSION_1_8.toString()
}
}
dependencies {
implementation project(':data')
implementation project(':domain')
implementation project(':presentation')
implementation project(':remote')
implementation project(':cache')
implementation project(':common')
implementation project(':device')
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation "com.google.android.material:material:$material_version"
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//navigation component
// implementation "androidx.navigation:navigation-fragment-ktx:2.3.2"
// implementation "androidx.navigation:navigation-ui-ktx:2.3.2"
// UI
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
// Ktx
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.0"
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0'
implementation "androidx.fragment:fragment-ktx:1.3.0"
// Navigation
implementation "android.arch.navigation:navigation-fragment-ktx:$version_navigation"
implementation "android.arch.navigation:navigation-ui-ktx:$version_navigation"
//viewpager2
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation 'com.thoughtbot:expandablerecyclerview:1.3'
implementation 'com.thoughtbot:expandablecheckrecyclerview:1.4'
//indicator
implementation 'me.relex:circleindicator:2.1.4'
//lottie
implementation "com.airbnb.android:lottie:3.4.1"
//datastore
implementation "androidx.datastore:datastore-preferences:1.0.0-alpha06"
implementation 'androidx.hilt:hilt-navigation-fragment:1.0.0-alpha03'
//LeakCanary
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
//Retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
//multidex
implementation 'com.android.support:multidex:1.0.3'
}
below my commons.gradle
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'
androidExtensions {
experimental = true
}
android {
// compileSdkVersion Versions.compileSdkVersion
// buildToolsVersion Versions.buildTool
// defaultConfig {
// minSdkVersion Versions.minSdk
// targetSdkVersion Versions.targetSdk
// versionCode Releases.versionCode
// versionName Releases.versionName
// vectorDrawables.useSupportLibrary = true
// }
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
kapt {
javacOptions {
// Increase the max count of errors from annotation processors.
// Default is 100.
option("-Xmaxerrs", 500)
}
// Configure kapt to correct error types for Hilt
correctErrorTypes true
}
buildFeatures{
dataBinding = true
}
kotlinOptions {
jvmTarget = "1.8"
}
lintOptions {
abortOnError false
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
//Loads packaged libraries in the libs folder
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation KotlinLibraries.kotlin
// implementation AndroidLibraries.coreKtx
//
// implementation Libraries.hilt
// implementation Libraries.hiltJetpack
// kapt Libraries.hiltCompiler
// kapt Libraries.hiltJetpackCompiler
//
// // For instrumentation tests
// androidTestImplementation Libraries.hiltAndroidTest
// kaptAndroidTest Libraries.hiltAndroidTestCompiler
//
// // For local unit tests
// testImplementation Libraries.hiltAndroidUnitTest
// kaptTest Libraries.hiltAndroidUnitTestCompiler
//
// implementation TestLibraries.androidTestRunner
// implementation TestLibraries.junit
// implementation TestLibraries.espresso
// implementation TestLibraries.espressoContrib
// Concurrency
implementation "io.reactivex.rxjava2:rxkotlin:$rxkotlin_version"
implementation "io.reactivex.rxjava2:rxandroid:$rxandroid_version"
//Hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hilt_androidx_version"
kapt "androidx.hilt:hilt-compiler:$hilt_androidx_version"
// Utils
implementation "com.jakewharton.threetenabp:threetenabp:$threetenabp_version"
}
below build.gradle where I have declare buildpaths
buildscript {
ext{
kotlin_version = "1.4.20"
version_navigation = "2.3.5"
hilt_version = '2.31.2-alpha'
version_navigation = "2.3.5"
version_lifecycle_extensions = "2.2.0"
lifecycle_version = "2.2.0"
hilt_androidx_version = "1.0.0-alpha03"
material_version = "1.3.0"
coroutines_version = "1.4.1"
junit_version = "4.13"
retrofit_version = "2.9.0"
okHttp_version = "4.9.0"
moshi_converter_version = '2.9.0'
moshi_version = '1.11.0'
mockwebserver_version = "4.9.0"
robolectric_version = "4.4"
mockito_version = "3.5.15"
google_truth_version = "1.0"
coroutines_test = "1.3.1"
room_version = "2.3.0"
threetenabp_version = "1.2.4"
leakcanary_version = "2.4"
timber_version = "4.7.1"
glide_version = "4.11.0"
androidsvg_version = "1.4"
rxkotlin_version = "2.4.0"
rxandroid_version = "2.1.1"
google_services_version = "4.3.8"
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$version_navigation"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.gms:google-services:$google_services_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
what I have tried following answers Could not find androidx.navigation:safe-args-gradle-plugin:1.0.0-alpha01 and it did not help I want to know what I am missing
You're using android.arch.navigation, which is not the AndroidX version of Navigation. You need to replace each with androidx.navigation as per the Declaring dependencies documentation
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$version_navigation"
And similarly with your dependencies:
// Navigation
implementation "androidx.navigation:navigation-fragment-ktx:$version_navigation"
implementation "androidx.navigation:navigation-ui-ktx:$version_navigation"

Android Studio Arctic Fox | 2020.3.1 Canary 15 |Compose Build error: Could not find androidx.compose:compose-compiler:1.0.0-beta06 |

as the title suggests I can't understand what the problem is when I try to deploy on the device.
The deployment fails when I try to add kotlinCompilerExtensionVersion '1.0.0-beta06' to the gradle
and the error message is "Could not resolve all files for configuration ': app: kotlin-extension'. Could not find androidx.compose: compose-compiler: 1.0.0-beta06."
What I'm trying to do is add a piece of code written in compose starting from an existing project, and I'm following this guide https://developer.android.com/jetpack/compose/interop/interop-apis
I paste my gradle below:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-parcelize'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs'
}
android {
compileSdkVersion rootProject.findProperty("android.compileSdkVersion") as Integer
buildToolsVersion "29.0.3"
defaultConfig {
applicationId findProperty("android.applicationId")
targetSdkVersion findProperty("android.targetSdkVersion") as Integer
minSdkVersion findProperty("android.minSdkVersion") as Integer
versionCode findProperty("android.minSdkVersion") as Integer
versionName findProperty("android.versionName")
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
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
buildFeatures {
dataBinding true
// Enables Jetpack Compose for this module
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.0.0-beta06'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.core:core-ktx:$ktx_version"
implementation "androidx.legacy:legacy-support-v4:$legacy_version"
implementation "androidx.constraintlayout:constraintlayout:$constraint_layout_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
implementation "com.google.android.material:material:$material_version"
// Retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version"
implementation "com.squareup.moshi:moshi-kotlin:$moshi_version"
// Navigation
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
// Compose
implementation "androidx.navigation:navigation-compose:$navigation_compose_version"
// Material Design
implementation "androidx.compose.material:material:$compose_version"
// Tooling support (Previews, etc.)
implementation "androidx.compose.ui:ui-tooling:$compose_version"
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation "androidx.compose.foundation:foundation:$compose_version"
// Material design icons
implementation "androidx.compose.material:material-icons-core:$compose_version"
implementation "androidx.compose.material:material-icons-extended:$compose_version"
// Integration with activitie
implementation "androidx.activity:activity-compose:1.3.0-alpha07"
// Integration with ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha04"
// Integration with observable
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.compose.runtime:runtime-rxjava2:$compose_version"
// Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutine_version"
// Room
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version"
// Work Manager
implementation "androidx.work:work-runtime-ktx:$work_version"
// Timber
implementation "com.jakewharton.timber:timber:$timber_version"
// Glide
implementation "com.github.bumptech.glide:glide:$glide_version"
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
I'm using last version at moment I'm writing:
android.targetSdkVersion=30
android.minSdkVersion=28
android.versionCode=1
android.versionName=1.0.0
# gradle.properties
kotlin_version=1.4.30
gradle_version=4.1.1
ktlint_version=9.2.1
safe_args_version=1.0.0
appcompat_version=1.2.0
ktx_version=1.3.2
legacy_version=1.0.0
constraint_layout_version=2.0.4
lifecycle_version=2.3.1
recyclerview_version=1.2.0
material_version=1.3.0
retrofit_version=2.9.0
moshi_version=1.9.2
navigation_version=2.3.5
navigation_compose_version=1.0.0-alpha10
compose_version=1.0.0-beta06
coroutine_version=1.4.2
room_version=2.3.0
work_version=2.5.0
timber_version=4.7.1
glide_version=4.12.0
I'm following the official setup but not seem woking
https://developer.android.com/jetpack/compose/setup
I had this issue yesterday. What I did was adding compiler in the compose option.
composeOptions {
kotlinCompilerVersion "1.4.32"
kotlinCompilerExtensionVersion "1.0.0-beta06"
}
Found somewhat similar issue to yours in stackoverflow here. You may need to upgrade your gradle version.
Also here, (if you haven't already) set ext.kotlin_version = ..... in the project gradle
buildscript {
ext.kotlin_version = "1.4.32"
ext { .... }
repositories {
mavenCentral()
google()
}
allprojects {
repositories {
mavenCentral()
google()
maven { url "https://jitpack.io" }
}
}
}
Finally found the problem.
Inside build.gradle (project level) I was using:
classpath "com.android.tools.build:gradle:$gradle_version"
So creating new Compose project I found how to fix the problem. In particular:
build.gradle (project level) is like:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.0-alpha15"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32"
classpath "org.jlleitschuh.gradle:ktlint-gradle:$ktlint_version"
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5")
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (app level) is like:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-parcelize'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs'
}
android {
compileSdkVersion rootProject.findProperty("android.compileSdkVersion") as Integer
buildToolsVersion "29.0.3"
defaultConfig {
applicationId findProperty("android.applicationId")
targetSdkVersion findProperty("android.targetSdkVersion") as Integer
minSdkVersion findProperty("android.minSdkVersion") as Integer
versionCode findProperty("android.minSdkVersion") as Integer
versionName findProperty("android.versionName")
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
}
kotlinOptions {
jvmTarget = '1.8'
useIR = true
}
buildFeatures {
dataBinding true
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion '1.4.32'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.core:core-ktx:$ktx_version"
implementation "androidx.legacy:legacy-support-v4:$legacy_version"
implementation "androidx.constraintlayout:constraintlayout:$constraint_layout_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.recyclerview:recyclerview:$recyclerview_version"
implementation "com.google.android.material:material:$material_version"
// Retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version"
implementation "com.squareup.moshi:moshi-kotlin:$moshi_version"
// Navigation
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
// Compose
implementation "androidx.navigation:navigation-compose:$navigation_compose_version"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.0-alpha07'
// Kotlin
implementation "androidx.fragment:fragment-ktx:$fragment_version"
// Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutine_version"
// Room
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version"
// Work Manager
implementation "androidx.work:work-runtime-ktx:$work_version"
// Timber
implementation "com.jakewharton.timber:timber:$timber_version"
// Glide
implementation "com.github.bumptech.glide:glide:$glide_version"
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
and Upgrade JDK to 11 using embedded JDK
and at last upgrade gradle to 7.0.0
P.S.
here gradle.properties:
# Common Android settings
android.compileSdkVersion=30
android.applicationId=com.composetest.application
android.targetSdkVersion=30
android.minSdkVersion=28
android.versionCode=1
android.versionName=1.0.0
# gradle.properties
kotlin_version=1.4.32
gradle_version=4.1.1
ktlint_version=9.2.1
safe_args_version=1.0.0
appcompat_version=1.3.0-beta01
ktx_version=1.3.2
legacy_version=1.0.0
constraint_layout_version=2.0.4
lifecycle_version=2.3.1
recyclerview_version=1.2.0
material_version=1.3.0
retrofit_version=2.9.0
moshi_version=1.9.2
navigation_version=2.3.5
navigation_compose_version=1.0.0-alpha10
compose_version=1.0.0-beta06
coroutine_version=1.4.2
room_version=2.3.0
work_version=2.5.0
timber_version=4.7.1
glide_version=4.12.0
fragment_version = 1.3.3

Crashlytics doesn't report the crash

I used Crashlytics, But It doesn't report the crash.
Analytics And Cloud messaging are ok, just Crashlytic doesn't work.
I added this to my Manifest:
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="true" />
But the issue persists.
Debug Mode Log:
09-05 09:15:50.876 11583 11583 D FirebaseCrashlytics: Loaded cached settings: {"settings_version":3,"cache_duration":86400,"features":{"collect_logged_exceptions":true,"collect_reports":true,"collect_analytics":false,"prompt_enabled":false,"push_enabled":false,"firebase_crashlytics_enabled":false},"app":{"status":"activated","update_required":false,"report_upload_variant":2,"native_report_upload_variant":2},"fabric":{"org_id":"5f4cde52d6a994c993000030","bundle_id":"com.aradteam.rbela"},"expires_at":1599303988714}
Gradle Project:
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
}
}
allprojects {
repositories {
jcenter()
maven{
url 'https://maven.google.com'
}
maven { url "https://jitpack.io" }
// google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Gradle App:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.aradteam.rbela"
minSdkVersion 21
targetSdkVersion 29
versionCode 4
versionName "3.1"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
buildFeatures {
dataBinding = true
viewBinding = true
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.core:core-ktx:1.3.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
testImplementation "junit:junit:4.13"
androidTestImplementation "androidx.test.ext:junit:1.1.1"
androidTestImplementation "androidx.test.espresso:espresso-core:3.2.0"
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.karumi:dexter:6.2.1'
implementation 'com.akexorcist:round-corner-progress-bar:2.1.1'
implementation 'androidx.multidex:multidex:2.0.1'
//retrofit
def retrofit2_version = '2.9.0'
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit2_version"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit2_version"
//rxjava
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
implementation "io.reactivex.rxjava2:rxkotlin:2.4.0"
//room
def room_version = "2.2.5"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
androidTestImplementation "androidx.room:room-testing:$room_version"
implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
def archLifecycleVersion = "2.2.0"
implementation "androidx.lifecycle:lifecycle-extensions:$archLifecycleVersion"
kapt "androidx.lifecycle:lifecycle-common-java8:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$archLifecycleVersion"
//navigation
def nav_version = '2.3.0'
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
//exoPlayer
def exo_version = "2.11.7"
implementation "com.google.android.exoplayer:exoplayer:$exo_version"
implementation "com.google.android.exoplayer:exoplayer-core:$exo_version"
implementation "com.google.android.exoplayer:exoplayer-ui:$exo_version"
implementation "com.google.android.exoplayer:exoplayer-dash:$exo_version"
def lottieVersion = '3.4.1'
implementation "com.airbnb.android:lottie:$lottieVersion"
//glide
def glide_version = '4.11.0'
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
// WorkManager
implementation "androidx.work:work-runtime-ktx:2.4.0"
//FireBase
implementation 'com.google.firebase:firebase-analytics-ktx:17.5.0'
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
}

Categories

Resources