発生している問題
Android Studioでアプリをデバッグしようとして、ブレークポイントで処理が止まったときに変数をホバーすると、「Evaluating...」の表示が出た後すぐに消えてしまいます。変数にカーソルを入れてCtrl+Alt+8で強制的に変数の中身を表示させようとすると、写真のような表示が出て変数の中身が見れません。
全ての変数が見られなくなっています。
試したこと
testCoverageEnabledをfalseにしてみたり、minifyEnabledを明示的にfalseにしてみたりしました。
また、実機でデバッグしていたのでエミュレータでも試しました。
該当のソースコード
Kotlin
1class DisplayAppSelectRecyclerAdapter(private val installedAppList: List<AppItem>, val activity: DisplayAppSelectActivity, val realm: Realm) : RecyclerView 2 .Adapter<DisplayAppSelectRecyclerAdapter.DisplayAppSelectViewHolder>() { 3 inner class DisplayAppSelectViewHolder(cell: View): RecyclerView.ViewHolder(cell) { 4 val appNameTextView = cell.findViewById<TextView>(R.id.appNameTextView3) 5 val checkBox = cell.findViewById<CheckBox>(R.id.checkBox) 6 val appIconImageView = cell.findViewById<ImageView>(R.id.appIconImageView3) 7 val dragHandleImageView = cell.findViewById<IconImageView>(R.id.dragHandleImageView) 8 } 9 10 override fun getItemCount(): Int = installedAppList.size 11 12 override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DisplayAppSelectViewHolder { 13 return DisplayAppSelectViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_display_app, parent, false)) 14 } 15 16 @SuppressLint("ClickableViewAccessibility") 17 override fun onBindViewHolder(holder: DisplayAppSelectViewHolder, position: Int) { 18 holder.apply { 19 val registeredList = realm.where<DisplayApps>().findFirst()!!.onNotificationList 20 val hasCheckedItem = registeredList.size > position 21 val notCheckedPos = position - ((if (registeredList.size == 0) 1 else registeredList.size) - 1) 22 val item = if (hasCheckedItem) installedAppList.first { it.appPackageName == registeredList[position]?.packageName } else { // ブレークポイント 23 installedAppList.filter{ registeredList.any { i -> i.packageName != it.appPackageName } || registeredList.size == 0 }[notCheckedPos] 24 } 25 26 appNameTextView.text = item.appName 27 appIconImageView.image = item.icon 28 dragHandleImageView.setOnTouchListener { v, event -> 29 if (event.actionMasked == MotionEvent.ACTION_DOWN) { 30 activity.startDragging(this) 31 } 32 true 33 } 34 dragHandleImageView.visibility = if (hasCheckedItem) View.VISIBLE 35 else View.INVISIBLE 36 checkBox.isChecked = hasCheckedItem 37 checkBox.setOnCheckedChangeListener { buttonView, isChecked -> 38 if (isChecked) { 39 dragHandleImageView.visibility = View.VISIBLE 40 realm.executeTransaction { 41 registeredList.add(realm.createObject<DisplayAppItem>().apply { 42 packageName = item.appPackageName 43 }) 44 } 45 notifyItemMoved(position, 0) 46 } else { 47 dragHandleImageView.visibility = View.INVISIBLE 48 realm.executeTransaction { 49 registeredList.first { it.packageName == item.appPackageName }.deleteFromRealm() 50 } 51 notifyItemMoved(position - 1, installedAppList.size - 1) 52 } 53 } 54 } 55 } 56 }
build.gradle(App)
Gradle
1apply plugin: 'com.android.application' 2 3apply plugin: 'kotlin-android' 4 5apply plugin: 'kotlin-android-extensions' 6 7apply plugin: 'io.fabric' 8 9apply plugin: 'com.google.android.gms.oss-licenses-plugin' 10 11apply plugin: 'kotlin-kapt' 12 13apply plugin: 'realm-android' 14 15android { 16 compileSdkVersion 29 17 buildToolsVersion "29.0.2" 18 defaultConfig { 19 applicationId "net.chikach.paylauncher" 20 minSdkVersion 22 21 targetSdkVersion 29 22 versionCode 6 23 versionName '0.3.1' 24 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 25 } 26 buildTypes { 27 release { 28 minifyEnabled true 29 shrinkResources true 30 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 31 manifestPlaceholders = [enableCrashlytics: "true", appId: "(広告アプリID)"] 32 resValue "string", "REWARD_AD_UNIT", "(広告ユニットID)" 33 } 34 debug { 35 ext.enableCrashlytics = false 36 versionNameSuffix ".99" 37 applicationIdSuffix ".debug" 38 manifestPlaceholders = [enableCrashlytics: "false", appId: "ca-app-pub-3940256099942544~3347511713"] 39 resValue "string", "REWARD_AD_UNIT", "ca-app-pub-3940256099942544/5224354917" 40 } 41 } 42} 43 44dependencies { 45 〜略〜 46} 47 48realm { 49 syncEnabled = true 50} 51 52apply plugin: 'com.google.gms.google-services' 53
正常に動作する別のアプリのbuild.gradle
Gradle
1apply plugin: 'com.android.application' 2apply plugin: 'kotlin-android' 3 4apply plugin: 'kotlin-android-extensions' 5 6apply plugin: 'kotlin-kapt' 7apply plugin: 'realm-android' 8 9apply plugin: 'io.fabric' 10apply plugin: 'com.google.android.gms.oss-licenses-plugin' 11 12 13android { 14 signingConfigs { 15 } 16 compileSdkVersion 29 17 buildTypes { 18 release { 19 minifyEnabled true 20 shrinkResources true 21 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 manifestPlaceholders = [enableCrashlytics: "true", appId: "(広告アプリID)"] 23 buildConfigField "String", "AD_APP_ID", "\"${manifestPlaceholders.get("appId")}\"" 24 resValue "string", "MAIN_AD_UNIT", "(広告ユニットID)" 25 resValue "string", "CALENDAR_AD_UNIT", "(広告ユニットID)" 26 resValue "string", "DETAIL_AD_UNIT", "(広告ユニットID)" 27 resValue "string", "MEMORIZE_RESULT_AD_UNIT", "(広告ユニットID)" 28 resValue "string", "COMPLETED_AD_UNIT", "(広告ユニットID)" 29 } 30 debug { 31 minifyEnabled false 32 ext.enableCrashlytics = false 33 versionNameSuffix '-debug' 34 applicationIdSuffix '.debug' 35 manifestPlaceholders = [enableCrashlytics: "false", appId: "ca-app-pub-3940256099942544~3347511713"] 36 buildConfigField "String", "AD_APP_ID", "\"${manifestPlaceholders.get("appId")}\"" 37 resValue "string", "MAIN_AD_UNIT", "ca-app-pub-3940256099942544/6300978111" 38 resValue "string", "CALENDAR_AD_UNIT", "ca-app-pub-3940256099942544/6300978111" 39 resValue "string", "DETAIL_AD_UNIT", "ca-app-pub-3940256099942544/6300978111" 40 resValue "string", "MEMORIZE_RESULT_AD_UNIT", "ca-app-pub-3940256099942544/6300978111" 41 resValue "string", "COMPLETED_AD_UNIT", "ca-app-pub-3940256099942544/6300978111" 42 } 43 } 44 defaultConfig { 45 applicationId 'net.chikach.smmanager' 46 minSdkVersion 23 47 targetSdkVersion 29 48 versionCode 79 49 versionName '11.0.3' 50 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 51 resConfigs "ja" 52 } 53 applicationVariants.all { variant -> 54 if (variant.buildType.name == "debug") { 55 variant.mergedFlavor.resourceConfigurations.add("xxhdpi") 56 } 57 } 58 productFlavors { 59 } 60 aaptOptions { 61 cruncherEnabled false 62 } 63 compileOptions { 64 sourceCompatibility JavaVersion.VERSION_1_8 65 targetCompatibility JavaVersion.VERSION_1_8 66 } 67} 68 69dependencies { 70 〜略〜 71} 72 73realm { 74 syncEnabled = true 75} 76 77apply plugin: 'com.google.gms.google-services'
環境
Android Studio 3.6 rc1 (投稿時点:3.6 Beta4)
私が作っているもう1個のアプリでは発生しないので、IDE側の問題ではないと思います。
Kotlin Plugin 1.3.61-release-Studio3.6-1
プロジェクトのKotlin Plugin: 1.3.61
Ubuntu 19.10
実行端末:Android 9 / Android 10
2019/12/19追記
上記の「もう1個のアプリ」でも発生したので、IDEが原因ではないかと疑い始めました。
しかし、今日Android Studio 3.6 rc1がリリースされたのでインストールしてみましたが改善せず。
実は投稿後も何回かいろいろアップデートがありましたが、今の所全て最新で改善していません。
Googleがこんな重大なバグを修正しないはずがないので、何か自分の設定が悪いのかもしれません。