Xamarin Android 应用程序在使用 r8 收缩编译时崩溃
Xamarin Android app crashes when it was compiled with r8 shrinking
我想缩小我的应用程序。
起初,我使用混淆器来解决这个问题,然后我今天找到了 R8。
我无法使用 proguard 缩小我的应用程序。 R8 也没有。
我在 Visual Studio Professional 2019 中使用 R8。
编译成功并出现一些警告,但在发布模式下使用 R8 编译我的应用程序后我的应用程序崩溃了。与混淆器相同。下面提到了警告。
在不收缩的情况下,在debug模式或release模式下编译都可以正常工作。
这是我在 phone 上 运行 应用程序时获得的设备日志。它发生在应用程序显示启动画面期间。
12-02 07:56:06.459: E/AndroidRuntime(13285): FATAL EXCEPTION: main
12-02 07:56:06.459: E/AndroidRuntime(13285): Process: com.myproject.myproject, PID: 13285
12-02 07:56:06.459: E/AndroidRuntime(13285): android.runtime.JavaProxyThrowable: System.TypeInitializationException: The type initializer for 'Registry' threw an exception. ---> System.TypeInitializationException: The type initializer for 'DryIoc.WrappersSupport' threw an exception. ---> System.TypeInitializationException: The type initializer for 'DryIoc.ReflectionTools' threw an exception. ---> DryIoc.ContainerException: Undefined Method '"GetDefault"' in Type DryIoc.ReflectionTools (including non-public=True)
12-02 07:56:06.459: E/AndroidRuntime(13285): at DryIoc.Throw.ThrowIfNull[T] (T arg, System.Int32 error, System.Object arg0, System.Object arg1, System.Object arg2, System.Object arg3) [0x0002b] in <b786dc28ccda4f9cada791c5ec73aee8>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at DryIoc.ReflectionTools.SingleMethod (System.Type type, System.String name, System.Boolean includeNonPublic) [0x00008] in <b786dc28ccda4f9cada791c5ec73aee8>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at DryIoc.ReflectionTools..cctor () [0x00000] in <b786dc28ccda4f9cada791c5ec73aee8>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): --- End of inner exception stack trace ---
12-02 07:56:06.459: E/AndroidRuntime(13285): at DryIoc.WrappersSupport..cctor () [0x000e6] in <b786dc28ccda4f9cada791c5ec73aee8>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): --- End of inner exception stack trace ---
12-02 07:56:06.459: E/AndroidRuntime(13285): --- End of inner exception stack trace ---
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.DryIoc.PrismApplication.CreateContainerExtension () [0x00006] in <54b3690e7a884e5392d6564fe1058f17>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.PrismApplicationBase.Initialize () [0x00000] in <69c22ecea5f44afaad9314eb228e8fb3>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.PrismApplicationBase.InitializeInternal () [0x00006] in <69c22ecea5f44afaad9314eb228e8fb3>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.PrismApplicationBase..ctor (Prism.IPlatformInitializer platformInitializer, System.Boolean setFormsDependencyResolver) [0x00038] in <69c22ecea5f44afaad9314eb228e8fb3>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.PrismApplicationBase..ctor (Prism.IPlatformInitializer platformInitializer) [0x00000] in <69c22ecea5f44afaad9314eb228e8fb3>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.DryIoc.PrismApplication..ctor (Prism.IPlatformInitializer platformInitializer) [0x00000] in <54b3690e7a884e5392d6564fe1058f17>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at myproject.App..ctor (Prism.IPlatformInitializer initializer) [0x00000] in <530a18ff74e7452ca04e0d812ab2f3ef>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at myproject.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0008c] in <c1eac816320349f19a935c6995da137f>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <f1027f4df0db4d02bec2ca8d90067419>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.10(intptr,intptr,intptr)
12-02 07:56:06.459: E/AndroidRuntime(13285): at md5bd5429e46ce9bb42cba5f37d4b72f961.MainActivity.n_onCreate(Native Method)
12-02 07:56:06.459: E/AndroidRuntime(13285): at md5bd5429e46ce9bb42cba5f37d4b72f961.MainActivity.onCreate(Unknown Source:0)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.Activity.performCreate(Activity.java:6986)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1232)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2863)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.ActivityThread.-wrap11(Unknown Source:0)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1649)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.os.Handler.dispatchMessage(Handler.java:105)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.os.Looper.loop(Looper.java:180)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.ActivityThread.main(ActivityThread.java:6950)
12-02 07:56:06.459: E/AndroidRuntime(13285): at java.lang.reflect.Method.invoke(Native Method)
12-02 07:56:06.459: E/AndroidRuntime(13285): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
12-02 07:56:06.459: E/AndroidRuntime(13285): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:835)
12-02 07:56:06.464: E/ActivityManager(1722): App crashed! Process: com.myproject.myproject
12-02 07:56:07.026: E/[B+]AppInfoService(4722): null
12-02 07:56:07.026: E/[B+]AppInfoService(4722): android.os.DeadObjectException
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.BinderProxy.transactNative(Native Method)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.BinderProxy.transact(Binder.java:756)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.services.b$a$a.a(SourceFile:122)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.services.AppInfoService.a(SourceFile:852)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.b.a.a(SourceFile:119)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.e.o.a(SourceFile:154)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.services.AppInfoService.a(SourceFile:1747)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.e.p$a.invoke(SourceFile:77)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at java.lang.reflect.Proxy.invoke(Proxy.java:913)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at $Proxy0.onResult(Unknown Source)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.RemoteCallback.sendResult(RemoteCallback.java:73)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.RemoteCallback.sendResult(RemoteCallback.java:50)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.IRemoteCallback$Stub.onTransact(IRemoteCallback.java:56)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.Binder.execTransact(Binder.java:682)
在第三行,我可以看到
"DryIoc.ContainerException: Undefined Method '"GetDefault"' 类型 DryIoc.ReflectionTools(包括非 public=True)"。
我假设 R8 删除了 DryIoc 中的 GetDefault 方法,因为我可以在 DryIoc 代码的第 12,052 行看到 GetDefault 方法。
https://github.com/dadhi/DryIoc/blob/master/src/DryIoc/Container.cs
然后我在proguard.cfg中写了"keep",如下所示。
但它似乎不起作用。错误是一样的,应用程序的大小也是一样的。
-keep class dryioc.** { *; }
我不确定它是否相关,但是当我用 R8 编译这个应用程序时我收到了一些警告。
它说没有办法解决两个 mscrolib 版本之间的冲突。
到目前为止,我也找不到修复这些警告的方法。
1> myproject.Android -> C:\Users\koki\source\repos\myproject\myproject\myproject\myproject\myproject.Android\bin\Release\myproject.Android.dll
1> "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" と "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" の間の競合を解決する方法がありません。一時的に、"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" を選択します。
1>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\Android\Xamarin.Android.D8.targets(81,5): warning XA4306: R8 does not support `MultiDexMainDexList` files when android:minSdkVersion >= 21
1>R8 : warning : The rule `-keep public class * extends androidx.versionedparcelable.VersionedParcelable {
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MSFTSIG.SF' already exists.
1>R8 : warning : Resource 'META-INF/MSFTSIG.RSA' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MSFTSIG.SF' already exists.
1>R8 : warning : Resource 'META-INF/MSFTSIG.RSA' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
这是Android项目下的当前proguard.cfg。
-keep class android.support.v7.widget.** { *; }
-keep class android.support.v7.widget.FitWindowsLinearLayout { *; }
-keep class com.google.common.** { *; }
-dontwarn com.google.common.**
-keep class io.grpc.** { *; }
-dontwarn io.grpc.**
-keep class io.opencensus.trace.** { *; }
-dontwarn io.opencensus.trace.**
-keep class DryIoc.** { *; }
-keep class DryIoc.** {
native <methods>;
}
-keepclassmembers class ** {
public static *** GetDefault(***);
}
关于 DryIoc 的最后三个规则似乎不起作用。不改变归档结果的大小
谢谢!
终于,我解决了问题。
我所做的是,在 Android 项目上将链接选项从 Sdk and User Assemblies 更改为 Sdk Assemblies Only。
我假设 Sdk and User Assemblies 比 Sdk Assemblies Only 保留了更多的代码,但显然不是。
谢谢你的帮助!
我想缩小我的应用程序。 起初,我使用混淆器来解决这个问题,然后我今天找到了 R8。 我无法使用 proguard 缩小我的应用程序。 R8 也没有。
我在 Visual Studio Professional 2019 中使用 R8。 编译成功并出现一些警告,但在发布模式下使用 R8 编译我的应用程序后我的应用程序崩溃了。与混淆器相同。下面提到了警告。 在不收缩的情况下,在debug模式或release模式下编译都可以正常工作。
这是我在 phone 上 运行 应用程序时获得的设备日志。它发生在应用程序显示启动画面期间。
12-02 07:56:06.459: E/AndroidRuntime(13285): FATAL EXCEPTION: main
12-02 07:56:06.459: E/AndroidRuntime(13285): Process: com.myproject.myproject, PID: 13285
12-02 07:56:06.459: E/AndroidRuntime(13285): android.runtime.JavaProxyThrowable: System.TypeInitializationException: The type initializer for 'Registry' threw an exception. ---> System.TypeInitializationException: The type initializer for 'DryIoc.WrappersSupport' threw an exception. ---> System.TypeInitializationException: The type initializer for 'DryIoc.ReflectionTools' threw an exception. ---> DryIoc.ContainerException: Undefined Method '"GetDefault"' in Type DryIoc.ReflectionTools (including non-public=True)
12-02 07:56:06.459: E/AndroidRuntime(13285): at DryIoc.Throw.ThrowIfNull[T] (T arg, System.Int32 error, System.Object arg0, System.Object arg1, System.Object arg2, System.Object arg3) [0x0002b] in <b786dc28ccda4f9cada791c5ec73aee8>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at DryIoc.ReflectionTools.SingleMethod (System.Type type, System.String name, System.Boolean includeNonPublic) [0x00008] in <b786dc28ccda4f9cada791c5ec73aee8>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at DryIoc.ReflectionTools..cctor () [0x00000] in <b786dc28ccda4f9cada791c5ec73aee8>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): --- End of inner exception stack trace ---
12-02 07:56:06.459: E/AndroidRuntime(13285): at DryIoc.WrappersSupport..cctor () [0x000e6] in <b786dc28ccda4f9cada791c5ec73aee8>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): --- End of inner exception stack trace ---
12-02 07:56:06.459: E/AndroidRuntime(13285): --- End of inner exception stack trace ---
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.DryIoc.PrismApplication.CreateContainerExtension () [0x00006] in <54b3690e7a884e5392d6564fe1058f17>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.PrismApplicationBase.Initialize () [0x00000] in <69c22ecea5f44afaad9314eb228e8fb3>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.PrismApplicationBase.InitializeInternal () [0x00006] in <69c22ecea5f44afaad9314eb228e8fb3>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.PrismApplicationBase..ctor (Prism.IPlatformInitializer platformInitializer, System.Boolean setFormsDependencyResolver) [0x00038] in <69c22ecea5f44afaad9314eb228e8fb3>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.PrismApplicationBase..ctor (Prism.IPlatformInitializer platformInitializer) [0x00000] in <69c22ecea5f44afaad9314eb228e8fb3>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Prism.DryIoc.PrismApplication..ctor (Prism.IPlatformInitializer platformInitializer) [0x00000] in <54b3690e7a884e5392d6564fe1058f17>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at myproject.App..ctor (Prism.IPlatformInitializer initializer) [0x00000] in <530a18ff74e7452ca04e0d812ab2f3ef>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at myproject.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0008c] in <c1eac816320349f19a935c6995da137f>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <f1027f4df0db4d02bec2ca8d90067419>:0
12-02 07:56:06.459: E/AndroidRuntime(13285): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.10(intptr,intptr,intptr)
12-02 07:56:06.459: E/AndroidRuntime(13285): at md5bd5429e46ce9bb42cba5f37d4b72f961.MainActivity.n_onCreate(Native Method)
12-02 07:56:06.459: E/AndroidRuntime(13285): at md5bd5429e46ce9bb42cba5f37d4b72f961.MainActivity.onCreate(Unknown Source:0)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.Activity.performCreate(Activity.java:6986)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1232)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2863)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.ActivityThread.-wrap11(Unknown Source:0)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1649)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.os.Handler.dispatchMessage(Handler.java:105)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.os.Looper.loop(Looper.java:180)
12-02 07:56:06.459: E/AndroidRuntime(13285): at android.app.ActivityThread.main(ActivityThread.java:6950)
12-02 07:56:06.459: E/AndroidRuntime(13285): at java.lang.reflect.Method.invoke(Native Method)
12-02 07:56:06.459: E/AndroidRuntime(13285): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
12-02 07:56:06.459: E/AndroidRuntime(13285): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:835)
12-02 07:56:06.464: E/ActivityManager(1722): App crashed! Process: com.myproject.myproject
12-02 07:56:07.026: E/[B+]AppInfoService(4722): null
12-02 07:56:07.026: E/[B+]AppInfoService(4722): android.os.DeadObjectException
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.BinderProxy.transactNative(Native Method)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.BinderProxy.transact(Binder.java:756)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.services.b$a$a.a(SourceFile:122)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.services.AppInfoService.a(SourceFile:852)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.b.a.a(SourceFile:119)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.e.o.a(SourceFile:154)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.services.AppInfoService.a(SourceFile:1747)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at com.htc.pitroad.appminer.e.p$a.invoke(SourceFile:77)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at java.lang.reflect.Proxy.invoke(Proxy.java:913)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at $Proxy0.onResult(Unknown Source)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.RemoteCallback.sendResult(RemoteCallback.java:73)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.RemoteCallback.sendResult(RemoteCallback.java:50)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.IRemoteCallback$Stub.onTransact(IRemoteCallback.java:56)
12-02 07:56:07.026: E/[B+]AppInfoService(4722): at android.os.Binder.execTransact(Binder.java:682)
在第三行,我可以看到 "DryIoc.ContainerException: Undefined Method '"GetDefault"' 类型 DryIoc.ReflectionTools(包括非 public=True)"。 我假设 R8 删除了 DryIoc 中的 GetDefault 方法,因为我可以在 DryIoc 代码的第 12,052 行看到 GetDefault 方法。 https://github.com/dadhi/DryIoc/blob/master/src/DryIoc/Container.cs
然后我在proguard.cfg中写了"keep",如下所示。 但它似乎不起作用。错误是一样的,应用程序的大小也是一样的。
-keep class dryioc.** { *; }
我不确定它是否相关,但是当我用 R8 编译这个应用程序时我收到了一些警告。 它说没有办法解决两个 mscrolib 版本之间的冲突。 到目前为止,我也找不到修复这些警告的方法。
1> myproject.Android -> C:\Users\koki\source\repos\myproject\myproject\myproject\myproject\myproject.Android\bin\Release\myproject.Android.dll
1> "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" と "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" の間の競合を解決する方法がありません。一時的に、"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" を選択します。
1>C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Xamarin\Android\Xamarin.Android.D8.targets(81,5): warning XA4306: R8 does not support `MultiDexMainDexList` files when android:minSdkVersion >= 21
1>R8 : warning : The rule `-keep public class * extends androidx.versionedparcelable.VersionedParcelable {
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MSFTSIG.SF' already exists.
1>R8 : warning : Resource 'META-INF/MSFTSIG.RSA' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MSFTSIG.SF' already exists.
1>R8 : warning : Resource 'META-INF/MSFTSIG.RSA' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
1>R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
这是Android项目下的当前proguard.cfg。
-keep class android.support.v7.widget.** { *; }
-keep class android.support.v7.widget.FitWindowsLinearLayout { *; }
-keep class com.google.common.** { *; }
-dontwarn com.google.common.**
-keep class io.grpc.** { *; }
-dontwarn io.grpc.**
-keep class io.opencensus.trace.** { *; }
-dontwarn io.opencensus.trace.**
-keep class DryIoc.** { *; }
-keep class DryIoc.** {
native <methods>;
}
-keepclassmembers class ** {
public static *** GetDefault(***);
}
关于 DryIoc 的最后三个规则似乎不起作用。不改变归档结果的大小
谢谢!
终于,我解决了问题。
我所做的是,在 Android 项目上将链接选项从 Sdk and User Assemblies 更改为 Sdk Assemblies Only。
我假设 Sdk and User Assemblies 比 Sdk Assemblies Only 保留了更多的代码,但显然不是。
谢谢你的帮助!