简体   繁体   中英

Xamarin.Android ClassNotFoundException 'mono.android.app.Application'

Note: I've asked a similar (albeit old and neglected) question in the past, but the same problem is reoccurring.

I am building an Android app with Xamarin, and I'm coming across a belligerent problem concerning Mono. Every time my app runs, it immediately crashes due to the following exception:
Java.Lang.ClassNotFoundException: mono.android.app.Application

It began yesterday when I was debugging my app normally. I noticed an issue I needed to fix, so I naturally stopped debugging and fixed the problem (only changing two strings completely unrelated to Xamarin and Mono). I've been dealing with this since then. There are a few StackOverflow questions and Xamarin Forums threads about this, but none of them have helped me solve this. My copy of Xamarin and the Android SDK are up to date. I also tried reinstalling Mono.

UPDATE:
The only reference to mono.android.app.Application is in my manifest:
<application android:name="mono.android.app.Application" ...>

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.devgregw.merge" android:installLocation="auto">
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-feature android:name="android.hardware.telephony" android:required="false" />
    <application android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/AppBaseTheme" android:logo="@drawable/icon" android:name="mono.android.app.Application" android:debuggable="true">
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
        <meta-data android:name="com.google.android.geo.API_KEY" android:value="(private)" />
    </application>
</manifest>

ClassNotFoundException is when the JAVA runtime is not able to locate the class that you are trying to use. Check first whether you have the imported the class correctly. Also it happened with me sometime when i was working in JAVA. It bugged for a while but when i did a clean and build it worked perfectly fine. Try that first! If problem still occurs i will have to see the code for the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM