My app can be started in two ways:
- "Normally" via the launcher
- As an Intent, when the user selects a contact from his address book
The first method works just fine. The main activity opens up, and the user can use the app. The second method however produces the following error/crash:
Unable to instantiate activity ComponentInfo{de.mystuff.myapp/de.mystuff.myapp.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "de.mystuff.myapp.MainActivity" on path: DexPathList[[zip file "/data/app/de.mystuff.myapp-1/base.apk"],nativeLibraryDirectories=[/data/app/de.mystuff.myapp-1/lib/arm, /data/app/de.mystuff.myapp-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
In my manifest I have declared the main activity as follows:
<activity android:name=".MainActivity" android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.CALL" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<data android:scheme="tel" />
</intent-filter>
</activity>
And my activity's code looks like this:
[Activity (Label = "MyApp", MainLauncher = true, Icon = "@mipmap/ic_launcher")]
public class MainActivity : Activity, SwipeRefreshLayout.IOnRefreshListener
{
AppSettings mAppSettings;
ContactListViewAdapter mListViewAdapter;
SwipeRefreshLayout mSwiper;
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.Main);
// Do some other init stuff
}
}