androidx

SupportMapFragment does not support AndroidX Fragment

泪湿孤枕 提交于 2019-12-28 03:04:36
问题 import com.google.android.gms.maps.SupportMapFragment; import androidx.fragment.Fragment; ... private SupportMapFragment mMapFragment; ... mMapFragment = (SupportMapFragment) form.getSupportFragmentManager().findFragmentByTag(MAP_FRAGMENT_TAG); Here, the IDE shows an error that androidx.fragment.Fragment cannot cast to SupportMapFragment (which extends android.support.v4.app.Fragment) I'm using the version 15.0.1 of the play-services-maps and version 1.0.0-beta01 of the AndroidX libraries. I

androidx.gridlayout.widget.GridLayout cannot be cast to android.widget.GridLayout

痞子三分冷 提交于 2019-12-25 18:35:35
问题 I am getting error "Caused by: java.lang.ClassCastException: androidx.gridlayout.widget.GridLayout cannot be cast to android.widget.GridLayout", in mainActivity.java GridLayout mygridLayout = findViewById(R.id.gridLayout); for(int i=0; i<mygridLayout.getChildCount(); i++) { ((ImageView) mygridLayout.getChildAt(i)).setImageResource(0); } 回答1: You are using GridLayout from AndroidX package in your layout.xml and you are importing Gridlayout from package android.widget in your source code. Use

Dagger2: ViewModel cannot be provided without an @Provides-annotated method

偶尔善良 提交于 2019-12-25 03:02:38
问题 I am following the architecture used by GithubBrowserSample by Google. But facing troubles while building the project. I have migrated the project to AndroidX. I have tried many answers available on StackOverflow without success. Here is the build exception I am facing while building: e:/windows/Apps/Verifi/VerifiApp/app/build/tmp/kapt3/stubs/debug/com/verifi/di/component/AppComponent.java:11: error: [Dagger/MissingBinding] [dagger.android.AndroidInjector.inject(T)] java.util.Map<java.lang

Kapt NonExistentClass exception in a Retrofit interface after migrating to androidX

早过忘川 提交于 2019-12-25 02:32:54
问题 I am using Retrofit , Dagger and Glide for my app. After migrating to androidX , kapt works perfectly with Dagger and Glide annotation processors. The projects build and syncs successfully, however, when I run the app, I get Kotlin compiler exceptions in my ApiService interface, where I use Retrofit annotations ApiService.kt import retrofit2.Call import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory import retrofit2.http.GET import retrofit2.http.POST import retrofit2

NonExistentClass cannot be converted to Annotation - app:kaptDebugAndroidTestKotlin

允我心安 提交于 2019-12-25 01:12:46
问题 I want to test a class using JUnit5 but at the time gradle runs the app:kaptDebugAndroidTestKotlin task I get the issue. I have already tried the solutions in the following links but nothing helps so far: NonExistentClass cannot be converted to Annotation error: incompatible types: NonExistentClass cannot be converted to Annotation @error.NonExistentClass() my project build.gradle file: buildscript { ext.kotlin_version = '1.3.40' ext.anko_version='0.10.8' ext.junit_version='5.5.0'

How to Implement Butterknife.Action in AndroidX?

五迷三道 提交于 2019-12-25 01:12:25
问题 I am not able to use ButterKnife.Action in andoidx, can someone give any suugestions on how to use ButterKnife.Action in androidx? classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-rc2' implementation 'com.jakewharton:butterknife:10.0.0' annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0' 回答1: I used the latest version of ButterKnife (10.2.1). Follow these steps and the problem will be fixed. //Step 1 : import this line import butterknife.Action; //Step 2 : in Scope

CameraX chooses low resolution for given aspect ratio

半腔热情 提交于 2019-12-24 07:34:34
问题 I want to get the best quality for square aspect ratio and setup the next preview and capture configs for CameraX. val SQUARE_ASPECT_RATIO = Rational(1, 1) val previewConfig = PreviewConfig.Builder().apply { setTargetAspectRatio(SQUARE_ASPECT_RATIO) setTargetRotation(viewFinder.display.rotation) }.build() preview = Preview(previewConfig) val imageCaptureConfig = ImageCaptureConfig.Builder().apply { setCaptureMode(ImageCapture.CaptureMode.MAX_QUALITY) setTargetAspectRatio(SQUARE_ASPECT_RATIO)

Error compiling Android app with Material Components and androidX

无人久伴 提交于 2019-12-24 03:39:16
问题 Android application suddenly refuses to build, it returns this error: Android resource linking failed error: resource style/Theme.MaterialComponents.Light.NoActionBar (aka it.duemilanet.icircle:style/Theme.MaterialComponents.Light.NoActionBar) not found. D:\GitLab\iCircleAndroidRMA\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1440: error: style attribute 'attr/colorSecondary (aka it.duemilanet.icircle:attr/colorSecondary)' not found. error: resource

How to make “See All Item” button to pass data from RecyclerView to Another RecyclerView fragment - AndroidX

安稳与你 提交于 2019-12-24 00:02:50
问题 Q uestion I want to make the "See All Item" button to pass data from RecyclerView to Another RecyclerView fragment it looks like play store that has the "More" button to see all item in another fragment AdapterSectionHotTrendingNews.java public class AdapterSectionHotTrendingNews extends RecyclerView.Adapter{ private Context mContext; private ArrayList<ModelSectionHotTrendingNews> modelSectionHotTrendingNews; public AdapterSectionHotTrendingNews(Context mContext, ArrayList

JaCoCo shows 0% coverage, even all tests had passed

ⅰ亾dé卋堺 提交于 2019-12-23 14:20:47
问题 I have written some test cases under androidTest directory. I am using androidx ( testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ) added dependencies: androidTestImplementation 'androidx.test:runner:1.1.0' androidTestImplementation 'androidx.test:rules:1.1.0' added JaCoCo as dependency, as well. When I run createDebugAndroidTestCoverageReport Gradle task, all the test cases run successfully but coverage is 0% in report I am guessing that is due to this error: V