question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot generate valid Android apk

See original GitHub issue

Description

I’ve tried to change the package bundle from aab to apk, for generating the apk through Archive..., but I couldn’t find the related option on the project properties, as I can on the Android project on a Xamarin Forms app (Android Options > Android Package Format). I’ve tried to force the Archive Manager to generate a apk by manually editing the .csproj file, with the following lines:

<PropertyGroup>
    <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
    <AndroidPackageFormat>pkg</AndroidPackageFormat>
    <AndroidUseAapt2>true</AndroidUseAapt2>
    <AndroidCreatePackagePerAbi>false</AndroidCreatePackagePerAbi>
    <AndroidLinkTool>r8</AndroidLinkTool>
    <AndroidDexTool>dx</AndroidDexTool>
</PropertyGroup>

but it fails stating that Failed to create App archive 'AppName'. Invalid Android Archive (no .apk files).

Is there something I’m doing wrong here?

P.D: I don’t know if generating an apk is a expected current feature, or if it isn’t and this should be a feature request. Just tell 😄

Steps to Reproduce

  1. Create a blank MAUI app project.
  2. Manually edit the .csproj to add the former lines.
  3. Ensure the build is configured for Release.
  4. Try to archive the app.

Version with bug

Preview 12 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11

Did you find any workaround?

No.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:26 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
jonathanpepperscommented, Feb 14, 2022

Ok, what is the crash?

You should check adb logcat output, some instructions here:

https://docs.microsoft.com/xamarin/android/deploy-test/debugging/android-debug-log#accessing-from-the-command-line

0reactions
jonathanpepperscommented, Apr 20, 2022

I believe there was discussion of three separate problems here.

For the FastDeploy issue, closing this and moving to: https://github.com/xamarin/xamarin-android/issues/6945

If you have other Android-related issues, file them for us there, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

APK not working made from Android Studio V 2.3.3
1 Answer 1 · Delete you build folder inside the App folder. · Goto Build>Generate Signed APk and provide recomended Details, make sure...
Read more >
Why I can't generate a signed apk file in Android Studio?
Go to Build-> Generate signed bundle/apk. Follow below video for further process. https://youtu.be/MjpaSGEmQHs. Thank me later..!
Read more >
Sign your app | Android Studio
In the Generate Signed Bundle or APK dialog, select Android App Bundle or APK and click Next. Below the field for Key store...
Read more >
Known issues with Android Studio and Android Gradle Plugin
If Studio doesn't start after an upgrade, the problem may be due to an invalid Android Studio configuration imported from a previous version...
Read more >
Analyze your build with the APK Analyzer | Android Studio
Android Studio includes an APK Analyzer that provides immediate insight into the composition of your APK after the build process completes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found