App Refuses to Install - INSTALL_FAILED_MISSING_SHARED_LIBRARY

谁都会走 提交于 2019-12-24 04:25:23

问题


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?


回答1:


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" />



回答2:


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.



来源:https://stackoverflow.com/questions/58148317/app-refuses-to-install-install-failed-missing-shared-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!