C# 带有股票期权列表的纯文本显示错误
好吧,我这里有一个奇怪的错误,我想不出来。我正在与android“android.intent.action.SEND”中的股票期权列表共享数据 共享单个图像效果很好,但当我尝试仅共享纯文本(如“asdfdgfsa”)时,程序会抛出此错误 “Java.Lang.RuntimeException:无法实例化活动 ComponentInfo{com.companyname.Reform/Reform.ReceiveDataFromApp.ReceiveDataFromApp}: java.lang.ClassNotFoundException:未找到类 路径上的“Reform.ReceiveDataFromApp.ReceiveDataFromApp” DexPathList[[zip文件 “/data/app/com.companyname.refrant-HFm6SmD1Y-a76oqwcxia==/base.apk”],nativeLibraryDirectories=[/data/app/com.companyname.refrant-HFm6SmD1Y-a76oqwcxia==/lib/x86, /系统/假LIB, /data/app/com.companyname.refrant-HFm6SmD1Y-a76oqwcxia==/base.apk!/lib/x86, /系统/lib、/vendor/lib]]”C# 带有股票期权列表的纯文本显示错误,c#,android,xamarin,C#,Android,Xamarin,好吧,我这里有一个奇怪的错误,我想不出来。我正在与android“android.intent.action.SEND”中的股票期权列表共享数据 共享单个图像效果很好,但当我尝试仅共享纯文本(如“asdfdgfsa”)时,程序会抛出此错误 “Java.Lang.RuntimeException:无法实例化活动 ComponentInfo{com.companyname.Reform/Reform.ReceiveDataFromApp.ReceiveDataFromApp}: java.lang.
我已经测试了您的代码并重现了该问题。您可以尝试在代码中设置
intent过滤器,而不是在AndroidManifest.xml
中设置intent过滤器
例如:
[Activity(Label = "RecieveDataFromApp", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "image/*", Label = "RecieveDataFromApp")]
[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "text/plain", Label = "RecieveDataFromApp")]
[IntentFilter(new[] { Intent.ActionSendMultiple }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "image/*", Label = "RecieveDataFromApp")]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
...
...
...
}
是的,我非常怀疑您发出的错误消息“无法识别活动..,未找到类..”。提供真实的错误消息和错误类型如何?更新为完整错误嘿!真的很奇怪,我在我的代码中有这个,并进行了测试,但没有让它工作。也许当时我忘了删除android清单代码,但现在效果很好!我知道你在这一部分有很多与xamarin合作的经验。如果我可以问的话,你有什么线索吗?我有一个朋友和我遇到了同样的问题,因此辞职了:
<activity android:name="Revamp.RecieveDataFromApp.RecieveDataFromApp" android:icon="@drawable/ic_home">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
[Activity(Label = "RecieveDataFromApp", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "image/*", Label = "RecieveDataFromApp")]
[IntentFilter(new[] { Intent.ActionSend }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "text/plain", Label = "RecieveDataFromApp")]
[IntentFilter(new[] { Intent.ActionSendMultiple }, Categories = new[] { Intent.CategoryDefault }, DataMimeType = "image/*", Label = "RecieveDataFromApp")]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
...
...
...
}