influxdata / influxdata/influxdb-client-java
Enabling minifi on android causes classCast Exeption
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 477
- フォーク
- 129
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.
I not sure how to reproduce this in a general way. In our android application https://github.com/omnt/OpenMobileNetworkToolkit the issues occures when minifiing is anabled.
As a workarround i added
```
-keep class com.influxdb.**
```
to the proguard rules. Im not entierly sure if the problem is no caused by our code but at least disabling the minifing for the influx lib solves the isse.
1. clone omnt git
2. remove the pro guard rule ```-keep class com.influxdb.**``` (if already included in the code version)
3. run the app and at random strings an url in settings -> logging -> remote influxDB
4. enable logging
5. restart the app (probably optional as it probably will crash
altetnativ the 0.2 release APK from the github page results in the same issue but is probably not helpfull for debugging
__Expected behavior:__
Same behavior of normal and minified build
__Actual behavior:__
minfied build causes an exeption
```
de....okus.OpenMobileNetworkToolkit E FATAL EXCEPTION: main Process: de.fraunhofer.fokus.OpenMobileNetworkToolkit, PID: 12351
java.lang.RuntimeException: Unable to start service de.fraunhofer.fokus.OpenMobileNetworkToolkit.LoggingService@f51d1f4 with Intent { cmp=de.fraunhofer.fokus.OpenMobileNetworkToolkit/.LoggingService }: java.lang.ClassCastException
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4839)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2289)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.ClassCastException
at androidx.appcompat.app.ToolbarActionBar$$ExternalSyntheticThrowCCEIfNotNull0.m(R8$$SyntheticClass:0)
at com.influxdb.client.internal.AbstractInfluxDBClient.(AbstractInfluxDBClient.java:126)
at com.influxdb.client.internal.AbstractInfluxDBClient.(AbstractInfluxDBClient.java:79)
at com.influxdb.client.internal.InfluxDBClientImpl.(InfluxDBClientImpl.java:99)
at com.influxdb.client.InfluxDBClientFactory.create(InfluxDBClientFactory.java:261)
at com.influxdb.client.InfluxDBClientFactory.create(InfluxDBClientFactory.java:180)
at de.fraunhofer.fokus.OpenMobileNetworkToolkit.InfluxDB2x.InfluxdbConnection.(InfluxdbConnection.java:57)
at de.fraunhofer.fokus.OpenMobileNetworkToolkit.InfluxDB2x.InfluxdbConnections.getRicInstance(InfluxdbConnections.java:43)
at de.fraunhofer.fokus.OpenMobileNetworkToolkit.LoggingService.setupRemoteInfluxDB(LoggingService.java:513)
at de.fraunhofer.fokus.OpenMobileNetworkToolkit.LoggingService.onStartCommand(LoggingService.java:314)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4821)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2289)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
```
__Specifications:__
- Client Version: 7.0.0 and 7.1.0 not sure about older versions
- InfluxDB Version: 2.x but issue happens also if no connection is possible
- JDK Version: java 11
- Platform: Android
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
com.influxdb.** ProGuard keep rule を削除して minified Android build を実行し、OpenMobileNetworkToolkit アプリで再現します。スタックトレースの AbstractInfluxDBClient と InfluxDBClientFactory から始め、次に InfluxdbConnection から LoggingService を経由する呼び出しを追跡します。minified build と non-minified build の両方で、この keep rule を必要とせずに ClassCastException を回避できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- android, java
- 領域
- mobile-dev
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 30/100