[英]Xamarin Android app encountering Didn't find class … on path: DexPathList[[zip file …]…]
[英]Didn’t find class “android.support.constraint.ConstraintLayout” on path: DexPathList in Xamarin.Android
我有一个非常简单的xamarin经典应用,带有以下.axml文件
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"/>
</android.support.constraint.ConstraintLayout>
及以下.cs文件
[Activity(Label = "sa", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Main);//error throws here
}
}
我找到了.gradle的下一个代码以启用约束布局
dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
但是,当然,它在Xamarin.Android中不起作用。 我试图安装Xamarin Android Constraint Layout 1.0.0-beta5
但不适用于Mono.Android 6.0。
我该如何解决我的问题? 有什么猜想吗?
出于某些原因,类android.support.constraint.ConstraintLayout
没有创建dex列表。
一些原因可能是:
使用Classy Shark确定发生了什么( https://github.com/google/android-classyshark )。 确保将链接器设置设置为“ None
以确保Mono链接器也不会将其删除。
我所需要做的就是更改mono框架版本为android.csproj v7.0
我最近(实际上是今天)遇到了这个问题,并且能够通过在链接器设置中添加例外来解决
<assembly fullname="Xamarin.Android.Support.Constraint.Layout">
<type fullname="*" />
</assembly>
<assembly fullname="Xamarin.Android.Support.Constraint.Layout.Solver">
<type fullname="*" />
</assembly>
显然,各个班级已经联系在一起了(如乔恩·道格拉斯建议的那样)。 通过添加此异常,可以防止类被链接掉。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.