【问题标题】:Xamarin ClassNotFoundException DexPathList [duplicate]Xamarin ClassNotFoundException DexPathList [重复]
【发布时间】:2017-12-11 10:45:22
【问题描述】:

我正在使用 .NET Standard Xamarin 解决方案,在 android 部分创建我自己的类时,它们没有包含在 .apk 中

我收到以下异常:

Java.Lang.ClassNotFoundException: Didn't find class "md51d6fa235ea481c9f9b4025a1ec847f9d.TestService" on path: DexPathList[[zip file "/data/app/com.gete.DriverApp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.gete.DriverApp-1/lib/arm64, /data/app/com.gete.DriverApp-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]

我已经用https://github.com/google/android-classyshark检查了:

方法总数:27569

md51d6... 文件夹不在 APK 中,但是当我检查 obj/Debug/android/bin/classes 时,该文件夹在里面

使用 API 版本:25

内置操作:编译

MainActivity.cs

[IntentFilter(new[] { Intent.ActionView },
    Categories = new[] { Intent.CategoryBrowsable, Intent.CategoryDefault },
    DataScheme = "test",
    DataHost = "open.rides",
    DataPathPrefix = "",
    AutoVerify = true)]
[Activity(Label = "DriverApp.Android", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
    protected override void OnCreate(Bundle bundle)
    {
        TabLayoutResource = Resource.Layout.Tabbar;
        ToolbarResource = Resource.Layout.Toolbar;

        base.OnCreate(bundle);

        global::Xamarin.Forms.Forms.Init(this, bundle);
        AndroidAppLinks.Init(this);

        LoadApplication(new App());

        var loci = new TestService();

    }
}

Services/TestService.cs

namespace DriverApp.Droid.Services
{
    class TestService : Service
    {
        public override IBinder OnBind(Intent intent)
        {
            throw new NotImplementedException();
        }
    }
}

【问题讨论】:

  • 该类不符合您的 .apk,请清理并重建,否则您需要重新启动 Visual Studio。
  • 有趣的是将此标记为重复,而问题指出它没有超过 64k 限制。最后,它与multi-dex无关,因为它已经启用了

标签: xamarin xamarin.android


【解决方案1】:

解决方案是从测试设备手动卸载应用程序。

单独清理和重建是行不通的,我必须先从设备上卸载应用程序....

【讨论】:

    猜你喜欢
    • 2013-07-20
    • 2015-07-01
    • 1970-01-01
    • 2017-10-21
    • 2018-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-07
    相关资源
    最近更新 更多