Parse error at Installation of APK file - android

My apk file format is like this:
xxxx-debug.apk
xx-xxx-debug-xxx-1.0.1.apk
I can download the apk files but I cannot install them. I'm facing the following error:
Parse error
There was a problem while parsing the package.
Code used for Installation:
protected void install(String fileName) {
Intent install = new Intent(Intent.ACTION_VIEW);
install.setDataAndType(Uri.fromFile(new File(fileName)),"application/vnd.android.package-archive");
startActivity(install);
}
When the apk file are downloaded, a number is appended at the end of the file e.g. some.apk becomes some-1.apk.
What I have tried/checked so far:
check on the option “Unknown sources.”
uses-permission android:name="android.permission.INSTALL_PACKAGES" tools:ignore="ProtectedPermissions"
android device version is 5.0.1
apk files are not corrupted because I've managed to install it in a different way

Please try disabling instant run and then generate apk.It will work.Hope it helps.

I faced this issue previously. This is how I debugged it.
First, install the APK through terminal
adb install path_to_your_app/name_of_your_app.apk
if you get error message:
adb: failed to install name_of_your_app.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries
this means that the architecture that you are building mismatches with the emulator architecture.
The way I fixed this issue is by forcing the build architecture in build.gradle
buildTypes {
debug {
ndk {
abiFilters 'x86_64'
}
Hope this helps

I had this same problem and for me the issue was the Minimum API Level. I had the minimum API too high, which means some devices were not able to use the app. In Unity go to: Player Settings > Other Settings > Identification >
Minimum API Level: This should be set to the minimum which for me Android 4.4 'KitKat' (API level 19)
Maximum API Level: This should be set to the maximum according to Google, see link https://developer.android.com/distribute/best-practices/develop/target-sdk

Related

React Native Flipper Debugging Issue : "NO APPLICATION SELECTED"

I have managed to connect a device ( I see logs and see the tree of React Native elements), but now I have an issue with connecting the app - "NO APPLICATION SELECTED" is what I see. Any ideas to fix it?
Ran into the same problem on both iOS and Android with Flipper 0.135.0. Managed to make both work by following the steps below.
iOS
This answer solved the issue for me.
tl;dr
brew update && brew upgrade idb-companion
Also make sure you are installing the correct Cocoapod of Flipper by specifying the exact version in your Podfile with (for version 0.135.0)
use_flipper!({ 'Flipper'=> '0.135.0' })
Android
Ensure that ReactNativeFlipper.java is in the correct folder, as in this example project.
With for example the applicationId com.domain.appName, the correct path is
android/app/src/debug/java/com/domain/appName/ReactNativeFlipper.java
In my project this Java file was in the incorrect folder, which resulted in the Logcat error
java.lang.ClassNotFoundException: com.domain.appName.ReactNativeFlipper
Ensure that you are running the latest version of Flipper (0.120.0 as of this message) and then:
For Android:
Bump the FLIPPER_VERSION variable in android/gradle.properties, for example: FLIPPER_VERSION=0.120.0.
Run ./gradlew clean in the android directory.
For iOS:
Call use_flipper with a specific version in ios/Podfile, for example: use_flipper!({ 'Flipper' => '0.120.0' }).
Run pod install in the ios directory.
Reference: https://fbflipper.com/docs/getting-started/react-native/#using-the-latest-flipper-sdk
Go to settings and check if the path for your Sdk is correct
In my case issue was with the Emulator OS and API.
I used following combination and it worked:
Device: Pixel 4a
OS: Android 12
API: (Release Name: S, API level: 31, ABI: arm64-v8a, Target: Android 12
I also faced this issue, I was not seeing android simulator and the app to select, but it was working fine for iOS without any config.
The problem with my setup was that in the Flipper settings, the android SDK's path was not correct, after updating the path and restarting Flipper, it automatically detected the simulator and the app.
Hope this helps.
I was able to solve that on Android, open ReactNativeFlipper.java file
In the first line package com.yourappname; change it to exactly your package name inside AndroidManifest.xml
In the MainApplication.java there is a line like
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
inside onCreate() function. In my project this line was commented. I removed the comment and run react-native run-android and flipper get connected to the app

App Refuses to Install - INSTALL_FAILED_MISSING_SHARED_LIBRARY

I am new to programming generally please I need some help!
My app was installing successfully after every update until i decided to add the 'com.github.PhilJay:MPAndroidChart:v3.1.0-alpha' library to the app because i need the user to be able to view some data in form of statistical charts.
The library was synced successfully and have used packages and classes therein successful. But when i try to install the app in my android device it returned this error:
Installation failed with message Failed to commit install session 590492354 with command cmd package
install-commit 590492354. Error: INSTALL_FAILED_MISSING_SHARED_LIBRARY: Package couldn't be installed in
/data/app/com.cenitscitech.www.etimebook-jOP-jv2YuNu7_8qnkfqp-A==: Package com.cenitscitech.www.etimebook requires unavailable shared library com.google.android.things; failing!.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing." I have pasted a screenshot here:
I uninstalled the existing version of the apk, cleared some memory space but keep on getting the same message! What should I do next please?
You are most likely installing on a device that is not an Android Things device. I suspect the library you added either has some transitive dependency on com.google.android.things, or something else changed in your project.
To get around this, you must do the following 2 things:
1. Mark that Android Things is not required on the device in your AndroidManifest.xml file:
<uses-library
android:name="com.google.android.things"
android:required="false"
tools:replace="android:required" />
(tools:replace is not strictly required, but it just there in case something in the manifest merge process overrides your setting.)
2. In your app's code, before making any calls to the Things APIs, make sure that they are available on the current device. This can be tested with the following code snippet:
public boolean isThingsDevice(Context context) {
final PackageManager pm = context.getPackageManager();
return pm.hasSystemFeature(PackageManager.FEATURE_EMBEDDED);
}
Only doing 1 should fix the install problem, but your app will crash if you make any Things API calls on a device that isn't an Android Things device.
Had a look in the com.github.PhilJay:MPAndroidChart:v3.1.0-alpha repository and did not find any reference to com.google.android.things inside the source code.
You need to remove the below entry in case it's found in the AndroidManifest.xml of your app for it to work on your device again:
<uses-library android:name="com.google.android.things" />

Android - Cordova version code issue

This is quite a weird one.
Basically, I decided to switch from using trigger.io to using cordova to build and compile my app (using ionic framework).
Everything is fine if I build an unsigned and unaligned app, but for production I have to sign and align the apk in order to upload it on the play store.
I have signed and aligned the apk properly, but when I tried to upload the apk, I got this error:
Your APK version code needs to be greater than 1457108319
Now, I read a couple of answers here on stack overflow saying that I just need to add this line in my project config.xml file:
<widget id="com.***********" android-versionCode="1457108319" version="5.0.0"
but the problem is that if I had this line of code, then gradle fails and I get this error:
Error: Error code 1 for command: cmd with args:
/s,/c,"c:\src\app-v5\platforms\android\gradlew cdvBuildRelease -b
c:\src\app-v5\platforms\android\build.gradle -Dorg.gradle.daemon=true
-Pandroid.useDeprecatedNdk=true"
Hovewer, if I change the versionCode to a 6 digit code instead of 10, I get no error, but again, I can't upload it to the store because the versionCode number is less than the app already released.
How can I solve this? I really have no idea what to do.
Thanks a lot
I actually resolved this. I had to add to my config.xml file the following (in <widget>, right after version):
android-versionCode="{this needs to be replaced, in my case, by the
current timestamp "
The downside is that I have to remember to put the new timestamp everytime for now.
I will, at some point, write some kind of script to do this for me.
Hope this helps someone
I had the same problem since updating to latest Cordova CLI (6.3.1) and latest android platform for cordova (5.2.2).
My old build had the following:
versionCode: 69000
from the config.xml file:
My new buid:
versionCode: 7000
from the config.xml file:
so when I upload the signed APK to the PlayStore I get the same error you had:
the problem is that 7000 is < to 69000
The issue comes from the gradle script (in platforms/android/build.gradle) which from what I understand generates the versionCode from what he finds in your config.xml.
Looks like it is missing some multiplication by 100 somewhere:
so far here is what can be done:
1: instead of using 0.70 as version number use 0.700
2: specify the versionCode in the config.xml file :
it worked for me in both cases.
Hope it helps.

How to rename(branding) browser built on Android Chromium source code?

I need to build custom browser based on android chromium with custom product name.
I found config files(src/chrome/app/theme/chromium/BRANDING) and changed PRODUCT_FULLNAME.
Then I have built APK with commands
src$ gclient sync
src$ ninja -C out/Release chrome_public_apk
in console.
Build completes without errors.
But after installation on target device, I saw default product name.
Configurations in src/build/common.gypi:
'branding%' : 'Chromium'
'buildtype%' : 'Dev'
'component%' : 'static_library'
chromium.gyp_env: { 'GYP_DEFINES': 'OS=android' }
What i do wrong? How rebrand chromium?
that package name string is defined in //chrome/android/BUILD.gn.

new blackberry app world error "bar manifest file package version must be greater than ..."

I've started getting a weird error message when trying to upload a playbook app update to BlackBerry world. I think this problem started after installing version 1.6.1 of their eclipse plugin.
The error message:
"The package version in your .bar manifest file for signals_playbook must be greater than the previous version, but lower than any the next release version added to the vendor portal. . Your .bar manifest file package version must be greater than 3.0. Correct your .bar manifest file and try again to continue."
My AndroidManifest.xml contains:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ca.rcp.mobile.cror.signals"
android:versionCode="7"
android:versionName="3.1" >
The Manifest file contained within the BAR shows this info:
Archive-Manifest-Version: 1.1
Archive-Created-By: Apk2Bar version 1.6.1
Package-Author: xxxxxxxx
Package-Author-Id: some hash xxxxxxxxx
Package-Name: xxxxx.cror.signals
Package-Id: some hash xxxxxxxxx
Package-Version: 1.0.7.1
Package-Version-Id: some hash xxxxxxxx
Package-Type: application
Package-Architecture: armle-v7
Package-Author-Certificate-Hash: some hash xxxxx
Application-Name: Railway Signals
Application-Id: some hash xxxxxxxx
Application-Version: 1.0.7.1
Application-Version-Id: some hash xxxxxxxxxxx
Application-Requires-System: Tablet OS/2.0.0.7109
My system:
Windows 7 x64 using Eclipse 3.7.2 with latest ADT and updates.
I can see why BlackBerry world is complaining, it thinks the version number is 1.0.7.1. How do I get it to show 3.1.0.0??
I tried editing the manifest file contained within the bar, saving it and resubmitting. But that didn't work (didn't think it would but was worth a try).
Does anyone know where is the 1.0.7.1 coming from?
Can I override it?
Thanks
Rob
We suddenly started having the same problem with our builds. Evidently something changed in the BlackBerry build tools. Try setting the application's android:versionName attribute to a 4-part value (such as 3.1.0.1). BlackBerry has always used this format (major.minor.micro.build) for native apps. It seems that unless your Android manifest has the same format, the BlackBerry build tools fail to parse the versionName attribute and use a fall-back. From what I can tell, the fall-back is to use the value of android:versionCode as the micro version in a default application version code; that is it sets the app version in the .bar file manifest to
1.0.<android:versionCode value>.1
(I sure wouldn't want to be the engineer that had to defend implementing this behavior.)
An alternative approach is to create a custom manifest file that has the app version you want. Create a file named MANIFEST.MF in the same directory as AndroidManifest.xml. Then add the specific .bar manifest entries you want. For instance, it might be:
Archive-Manifest-Version: 1.1
Package-Version: 3.1.0.0
Application-Version: 3.1.0.0
Then open the project properties in Eclipse, navigate to BlackBerry, and for the "Custom BAR Manifest" drop-down, select "Add custom values (merge)".
Thank you, Ted!
There is another link on this topic;
http://supportforums.blackberry.com/t5/BlackBerry-World-Development/The-package-version-in-your-bar-manifest-file-for-New-Bundle/td-p/2754567
We started to notice problem after move to Gradle:
Before
AndroidManifest.xml:
android:versionCode="1312310309" android:versionName="2.28.4"
MANIFEST.MF:
Application-Version: 14.1231.309.0
After
AndroidManifest.xml:
android:versionCode="134" android:versionName="2.30.31402271059"
MANIFEST.MF
Application-Version: 1.0.134.0
I also had the same problem but I fixed it by adding this line in my Android Manifest file android:versionCode="30" previously I had android:versionCode="29" so upgraded it by one .And the problem got fixed for me.

Categories

Resources