Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

The Error message:

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?

like image 202
nomacreates Avatar asked Apr 17 '26 07:04

nomacreates


2 Answers

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.

like image 105
kenny_k Avatar answered Apr 30 '26 14:04

kenny_k


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" />
like image 21
ahasbini Avatar answered Apr 30 '26 15:04

ahasbini



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!