question

DenisCreator-0596 avatar image
0 Votes"
DenisCreator-0596 asked RobCaplan edited

Xamarin.Forms Not found MainActivity for Android 8 API 28

Hi everyone,

Faced with the issue on Android 8 API 26 with the following error during deploy of application:

Detecting existing process

am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "com.companyname.App/crc64d9c3a76b38d59d78.MainActivity"
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.companyname.App/crc64d9c3a76b38d59d78.MainActivity }

Error type 3
Error: Activity class {com.companyname.App/crc64d9c3a76b38d59d78.MainActivity} does not exist.
Failed to launch android application

I use Xamarin.Forms 5.0

Does anybody faced with such issue ?
How to fix it ?
Application works properly on Android 9 and above ...

Today I also found that always after installation I see the following logs:

2021-08-15 09:09:45.136 832-1211/? V/HwPackageManagerService: POST_INSTALL: pkgName = com.companyname.App, pkgUri = /data/app/vmdl204364668.tmp;, pkgInstalledPath = /data/app/vmdl204364668.tmp, pkgInstallerPackageName = , pkgVerName = 1.0, pkgVerCode = 1, resultCode = 1, pkgUpdate = false, pkgMetaHash = 086776b2ea1bb56e372d0c3213103078cedc07b05747a62cec55f7dbb9b6b891
2021-08-15 09:09:45.136 832-1211/? W/ActivityManager: Skipping broadcast of Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.App flg=0x4000010 (has extras) }: user 10 is stopped
2021-08-15 09:09:45.145 10763-10763/? I/Pm: Package com.companyname.App installed in 3038 ms
2021-08-15 09:09:45.147 832-5958/? W/System.err: java.lang.SecurityException: Caller has no access to session 204364668
2021-08-15 09:09:45.147 832-5958/? W/System.err: at com.android.server.pm.PackageInstallerService.abandonSession(PackageInstallerService.java:774)
2021-08-15 09:09:45.148 832-5958/? W/System.err: at android.content.pm.IPackageInstaller$Stub.onTransact(IPackageInstaller.java:97)
2021-08-15 09:09:45.148 832-5958/? W/System.err: at android.os.Binder.execTransact(Binder.java:675)
2021-08-15 09:09:45.151 10763-10763/? I/app_process: System.exit called, status: 0

[123289-install-issue0.log][1]


[1]: /answers/storage/attachments/123289-install-issue0.log
dotnet-xamarin
install-issue0.log (178.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DenisCreator-0596 avatar image
0 Votes"
DenisCreator-0596 answered DenisCreator-0596 edited

I have found the answer how to fix the issue ...

This question helped me https://stackoverflow.com/questions/47708240/missing-component-mainactivity-xamarin-android

By some reason this application was already installed on device, but pm list packages did not show it

... but when I've run command .\adb.exe uninstall com.companyname.App it returned Success meaning that some packages was installed ... Second run of this command returns the error, which meant that I was right ...

And application starts working after this !!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.