r8 shrinker Java .Lang.NoSuchMethodError Message = no non-stati c метод в формах xamarin - PullRequest
0 голосов
/ 17 июня 2020

Я использую d8 + r8 + Multi-Dex для развертывания моего приложения Xamarin Forms. Однако при включении r8 я получаю какое-то странное исключение. Я проверил режим отладки и получаю эту устаревшую ошибку. Я также настроил файл proguard, чтобы исключить некоторые файлы, но это не помогло. Java.Lang.NoSuchMethodError

06-17 19:06:08.090 D/Mono    (31705): Assembly Loader probing location: '//Facades/Xamarin.Forms.Platform.Android.AppLinks.exe'.
06-17 19:06:08.195 D/Mono    (31705): DllImport searching in: '__Internal' ('(null)').
06-17 19:06:08.195 D/Mono    (31705): Searching for 'java_interop_jnienv_call_static_int_method_a'.
06-17 19:06:08.195 D/Mono    (31705): Probing 'java_interop_jnienv_call_static_int_method_a'.
06-17 19:06:08.196 D/Mono    (31705): Found as 'java_interop_jnienv_call_static_int_method_a'.
06-17 19:06:08.322 D/Mono    (31705): DllImport searching in: '__Internal' ('(null)').
06-17 19:06:08.322 D/Mono    (31705): Searching for 'java_interop_jnienv_call_nonvirtual_int_method_a'.
06-17 19:06:08.322 D/Mono    (31705): Probing 'java_interop_jnienv_call_nonvirtual_int_method_a'.
06-17 19:06:08.322 D/Mono    (31705): Found as 'java_interop_jnienv_call_nonvirtual_int_method_a'.
06-17 19:06:08.389 I/FA      (31705): Tag Manager is not found and thus will not be used
06-17 19:06:08.391 D/OpenGLRenderer(31705): HWUI GL Pipeline
06-17 19:06:08.398 E/FA      (31705): Missing google_app_id. Firebase Analytics disabled. See 
06-17 19:06:08.560 D/Mono    (31705): Requesting loading reference 9 (of 13) of /storage/emulated/0/Android/data/com.AZEE.wquran/files/.__override__/Xamarin.AndroidX.Fragment.dll
06-17 19:06:08.560 D/Mono    (31705): Loading reference 9 of /storage/emulated/0/Android/data/com.AZEE.wquran/files/.__override__/Xamarin.AndroidX.Fragment.dll asmctx DEFAULT, looking for Xamarin.AndroidX.Lifecycle.LiveData.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
06-17 19:06:08.560 D/Mono    (31705): Assembly Ref addref Xamarin.AndroidX.Fragment[0xe9e72860] -> Xamarin.AndroidX.Lifecycle.LiveData.Core[0xe9e72aa0]: 2
06-17 19:06:08.652 D/Mono    (31705): DllImport searching in: '__Internal' ('(null)').
06-17 19:06:08.652 D/Mono    (31705): Searching for 'java_interop_jnienv_call_object_method'.
06-17 19:06:08.652 D/Mono    (31705): Probing 'java_interop_jnienv_call_object_method'.
06-17 19:06:08.652 D/Mono    (31705): Found as 'java_interop_jnienv_call_object_method'.
06-17 19:06:08.825 W/DynamiteModule(31705): Local module descriptor class for com.google.android.gms.ads.dynamite not found.
**Java.Lang.NoSuchMethodError:** 'no non-static method "Landroidx/fragment/app/FragmentTransaction;.add(ILandroidx/fragment/app/Fragment;)Landroidx/fragment/app/FragmentTransaction;"'

Thread started: <Thread Pool> #10
Thread started: <Thread Pool> #11
Thread finished: <Thread Pool> #7
The thread 0x7 has exited with code 0 (0x0).

"<threadpool thread>"
"<threadpool thread>"

"<unnamed thread>"  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Diagnostics.Debugger.Mono_UnhandledException_internal (System.Exception) <0x00012>
  at System.Diagnostics.Debugger.Mono_UnhandledException (System.Exception) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Diagnostics/Debugger.cs:125
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.63 (intptr,intptr) [0x00020] in <eaa205f580954a64824b74a79fa87c62>:0
  at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.63 (intptr,intptr) [0x00030] in <eaa205f580954a64824b74a79fa87c62>:0

файл proguard

-dontwarn java.lang.invoke.**
-keep public class * implements androidx.versionedparcelable.VersionedParcelable
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**

-keep class android.support.V7.**
-keep class android.support.v7.widget.** { *; }
-dontwarn android.support.v7.widget.**
-keep class android.support.v4.widget.Space { *; }
-dontwarn android.support.v4.widget.Space

-keep class MediaManager.CrossMediaManager.**
-keep class android.support.v4.media.MediaBrowserCompat
-keep class android.support.v4.media.**

-keep class androidX.appCompat.widget.**
-keep class Plugin.InAppBilling.**
-keep class Plugin.InAppBilling.InAppBillingImplementation.**

1 Ответ

0 голосов
/ 21 июня 2020

Я удалил последние 6 строк из файла proguard, и все заработало.

-keep class MediaManager.CrossMediaManager.**
-keep class android.support.v4.media.MediaBrowserCompat
-keep class android.support.v4.media.**

-keep class androidX.appCompat.widget.**
-keep class Plugin.InAppBilling.**
-keep class Plugin.InAppBilling.InAppBillingImplementation.**
...