[Fixed] android studio error building app not installed as package appears to be invalid – Android

by
Ali Hasan
android

Quick Fix: Ensure that you are installing an app from a trusted source, such as the Google Play Store. If you are installing an app from a third-party source, make sure that the app is signed with a valid certificate.

The Problem:

When trying to build and install an Android app using Android Studio, users encounter two errors:

  1. "Invoke-customs are only supported starting with Android O (–min-api 26)" while building the APK.

  2. "App not installed as package appears to be invalid" when attempting to install the built APK on a device.

These errors occur despite adding compileOptions to the build gradle to resolve the first issue.

Find the problem statement under 150 words.

The Solutions:

Solution 1: Verify Installation Method

The "app not installed as package appears to be invalid" error typically occurs when installing an APK file on a device running Android 10 or higher. This is because the APK may be missing essential metadata and Android files.

To resolve this issue, ensure that you are not installing the APK by sharing it from someone’s phone. Instead, create an APK file using Android Studio and follow these steps:

  1. Open your Android Studio project.
  2. Navigate to the "Build APK" option.
  3. Select "Generate Signed APK" or "Build APK (Release Variant)."
  4. Build and save the APK file on your computer.
  5. Transfer the APK file to the target device and install it.

By creating the APK file in Android Studio, you ensure that it contains all the necessary files and data to install it successfully.

Solution 2: Clean and Rebuild the Project

One possible solution to the “app not installed as package appears to be invalid” error after building the APK is to clean the project and rebuild it again. This process removes any temporary files or cached data that may be causing the issue.

Steps:

  1. In Android Studio, click on “Build” > “Clean Project”.
  2. Then, click on “Build” > “Rebuild Project”.
  3. Wait for the build process to complete.
  4. Try installing the APK on your device again.

Q&A

why the error app not installed as package appears too be invalid occur

some metadata and Android files are not included inside the package.

how to fix the error

Clean your project & build again.

Video Explanation:

The following video, titled "Fix App Not Installed As Package Appears To Be Invalid on Android ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

... fix the “App Not Installed As Package Appears To Be Invalid” error. This usually happens when you are trying to install an older version of ...