unavailable shared library com.google.android.maps; failing! - android device - android

I'm trying to install my apk (which uses google maps) in android device. Its not getting installed. when i collect the log from the device it shows "unavailable shared library com.google.android.maps; failing!"
how to solve the above problem.?
I have given following line inside application tag.
<uses-library
android:name="com.google.android.maps"
android:required="true" >
</uses-library>
Following is my logs
02-03 20:19:42.025 D/PackageManager( 2888): Scanning package com.test.sd.view
02-03 20:19:42.025 E/PackageManager( 2888): Package com.test.sd.view requires unavailable shared library com.google.android.maps; failing!
02-03 20:19:42.025 W/PackageManager( 2888): Package couldn't be installed in /data/app/com.test.sd.view.apk
02-03 20:19:42.085 D/dalvikvm( 2888): GC_EXPLICIT freed 823K, 60% free 15109K/36871K, paused 2ms+5ms
02-03 20:19:42.085 D/InstallAppProgress( 4485): Installation error code: -9

Guess it is an issue with the device. Refer http://innovator.samsungmobile.com/bbs/discussion/view.do?platformId=0&parentCategoryId=0&messageId=101074&boardId=10. Try loading maps library externally.

In case with real device try remove from manifest file:
<uses-library android:name="com.google.android.maps" />

Related

Android BIND_JOB_SERVICE & sepolicy

I have a valid manifest file with the right permission & "exported" set as well. But, I still get the below error:
Error: Requires permission android.permission.BIND_JOB_SERVICE
The command (initiated over adb) is a running a service (via "am startservice") & the manifest file has these details:
<service
android:name=".MyService"
android:enabled="true"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
Logcat doesn't have anything useful, just throws the permission required error (which the APK already has). This seems like a sepolicy restriction since if I remove the policy (by running "setenforce 0"), then the command works fine (no errors seen as well)
I've tried running in "permissive" mode but it doesn't show any useful messages. Is there any way to figure out what policy needs to be turned on?
Here's the actual error from logcat:
05-16 14:03:32.892 566 897 W ActivityManager: Permission Denial: Accessing service com.abc.def/.MyService from pid=6757, uid=2000 requires android.permission.BIND_JOB_SERVICE
What I found was, putting the same command in a bash script and sourcing it works fine!!

Various errors moving app to sdcard depending on api level

A user asked me about a crash while using the app on the sd card. My app was not movable to the sdcard so I added to the manifest android:installLocation="auto" and tried to move it to the external memory. Using it on my real device (34 gb/ 47 gb free on internal/external memory) I get the space not sufficient error. I understood that this is a generic error used for other issues so I fired up the emulator and checked the logcat.
Partial manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.user.app"
android:installLocation="auto"
>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.VIBRATE" />
<queries>
<package android:name="org...." />
</queries>
On my device with android 11 I get
D/PackageManager: START MOVE PACKAGE: pkg{com.github.user.app.debug}
volumeUuid{3231-6462}
I/ActivityTaskManager: START u0 {flg=0x24000000 cmp=com.android.settings/.deviceinfo.StorageWizardMoveProgress (has extras)} from uid 1000
D/RestrictionPolicy: isSettingsChangesAllowedAsUser, userId 0 : true
E/LockGuard: Calling thread PackageManager is holding PACKAGES while trying to acquire DPMS
java.lang.RuntimeException: Calling thread PackageManager is holding PACKAGES while trying to acquire DPMS
at com.android.server.LockGuard.doLog(LockGuard.java:179)
at com.android.server.LockGuard.guard(LockGuard.java:166)
at com.android.server.devicepolicy.DevicePolicyManagerService.getLockObject(DevicePolicyManagerService.java:779)
at com.android.server.devicepolicy.DevicePolicyManagerService.packageHasActiveAdmins(DevicePolicyManagerService.java:5158)
at com.android.server.pm.PackageManagerService.isPackageDeviceAdmin(PackageManagerService.java:22599)
at com.android.server.pm.PackageManagerService.isPackageDeviceAdminOnAnyUser(PackageManagerService.java:22572)
at com.android.server.pm.PackageManagerService.movePackageInternal(PackageManagerService.java:28919)
at com.android.server.pm.PackageManagerService.lambda$movePackage$45$PackageManagerService(PackageManagerService.java:28837)
at com.android.server.pm.-$$Lambda$PackageManagerService$fXZo1oAlF-92gGHcSdrHuC0WLPc.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.os.HandlerThread.run(HandlerThread.java:67)
at com.android.server.ServiceThread.run(ServiceThread.java:44)
...
V/PackageManager: Move 6 created Bundle[{android.intent.extra.PACKAGE_NAME=com.github.user.app.debug, android.intent.extra.TITLE=App-dev}]
I/PackageManager: measurePath: /storage/3231-6462
...
V/PackageManager: Move 6 status 53
...
D/PackageManager: result of install: -15{120868786}
V/PackageManager: Move 6 status -6
On an android api 30 emulator
W/PackageManager: Failed to move com.github.user.app.debug
com.android.server.pm.PackageManagerException: Move only supported for modern cluster style installs
at com.android.server.pm.PackageManagerService.movePackageInternal(PackageManagerService.java:23180)
at com.android.server.pm.PackageManagerService.lambda$movePackage$41$PackageManagerService(PackageManagerService.java:23125)
at com.android.server.pm.-$$Lambda$PackageManagerService$ECakc05vOVsUm8ydpi2Z-HghH4w.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
at com.android.server.ServiceThread.run(ServiceThread.java:44)
This is the interested part in PackageManager:
final File probe = new File(pkg.codePath);
final File probeOat = new File(probe, "oat");
if (!probe.isDirectory() || !probeOat.isDirectory()) {
throw new PackageManagerException(MOVE_FAILED_INTERNAL_ERROR,
"Move only supported for modern cluster style installs");
}
I tried again on a fresh api 25 emulator and I get the same error, different exception:
W/installd: type=1400 audit(0.0:879): avc: denied { sys_admin } for capability=21 scontext=u:r:installd:s0 tcontext=u:r:installd:s0 tclass=capability permissive=0
D/installd: Detected label change from u:object_r:system_data_file:s0 to u:object_r:app_data_file:s0:c512,c768 at /mnt/expand/2e6f3762-8f82-4c9f-9633-f74b10070b25/user/0/com.github. user.app.debug; running recursive restorecon
D/installd: Detected label change from u:object_r:system_data_file:s0 to u:object_r:app_data_file:s0:c512,c768 at /mnt/expand/2e6f3762-8f82-4c9f-9633-f74b10070b25/user_de/0/com.github. user.app.debug; running recursive restorecon
D/installd: Copying /data/user_de/0/com.github. user.app.debug to /mnt/expand/2e6f3762-8f82-4c9f-9633-f74b10070b25/user_de/0
D/installd: Copying /data/data/com.github. user.app.debug to /mnt/expand/2e6f3762-8f82-4c9f-9633-f74b10070b25/user/0
W/PackageParser: Unknown element under <manifest>: queries at /mnt/expand/2e6f3762-8f82-4c9f-9633-f74b10070b25/app/com.github.user.app.debug-1/base.apk Binary XML file line #18
W/PackageManager: installPackageLI
D/PackageManager: Cleaning up com.github.user.app.debug on 2e6f3762-8f82-4c9f-9633-f74b10070b25
V/PackageManager: Move 0 status -6
D/StorageSettings: Finished with status -6
W/ActivityManager: Duplicate finish request
I tried to upload an apk instead of letting Android Studio do it but it did not work. Googling the errors only brought me to the soure code links. Any help is appreciated.
I experienced the same issue on an APK installed from Android Studio. Switching between debug and release did not make a difference.
My goal was to install the app onto external to test it, which I was finally able to do under Run/Debug Configurations > Installation Options > Install Flags by adding --install-location 2

Google Mobile Vision library not downloading

I am trying to implement the Google Mobile Vision TextRecogniser API into my app, to read text off a given Image. When I try to use the feature, I get this error:
W/DynamiteModule: Local module descriptor class for com.google.android.gms.vision.dynamite not found.
I/DynamiteModule: Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:801
I/DynamiteModule: Selected remote version of com.google.android.gms.vision.dynamite, version >= 801
W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000005/n/arm64-v8a
D/ApplicationLoaders: ignored Vulkan layer search path /data/app/com.google.android.gms-1/lib/arm64:/system/fake-libs64:/data/app/com.google.android.gms-1/base.apk!/lib/arm64-v8a for namespace 0x7a2e8c60f0
I/Vision: Loading libocr library
I/Vision: libocr load status: false
I/TextRecognizerCreatorImpl: Requesting download for native text recognizer
W/TextNativeHandle: Native handle not yet available. Reverting to no-op handle.
Meaning, I believe, that the library wasnt downloaded to the phone.
I have troubleshooted for common error sources, including missing internet connection, lack of memory, missing dependencies, rebooting the phone, updating Google play services, waiting a while etc. Google repository and Play services are also updated in Android studio.
Yet, I still get the same error, even when trying my App on different devices.
I believe that the download is performed by the Google Play Service App. The Libraries are downloaded as a zip file in the folder
/data/data/com.google.android.gms/cache/downloadservice
and are extracted to
/data/data/com.google.android.gms/files/com.google.android.gms.vision
and our app always check for the library in path
06-02 22:43:53.379 30258-30419/pzy64.searchbot I/Vision: Loading library libocr.so
which shows the error if the files are absent
06-02 22:43:53.475 30258-30419/pzy64.searchbot I/Vision: libocr.so library load status: false
otherwise
06-03 09:42:33.372 23451-24679/pzy64.searchbot I/Vision: libocr.so library load status: true
After download,
In my case (ARM) the folder size of
/data/data/com.google.android.gms/files/com.google.android.gms.vision
is around 5MB.(So the file downloaded is less than this size, The size may vary for different architecture .It took more time to download in my Asus Phone (x86)).
See my Logcat - (filter using 'Vision').
06-02 22:45:45.489 14970-31705/? I/Vision: Registration status ocr_armeabi_v7a.zip: The download is in progress.
06-02 22:45:45.542 14970-31705/? I/Vision: Download status ocr_armeabi_v7a.zip: The download is in progress.
06-02 22:43:53.379 30258-30419/pzy64.searchbot I/Vision: Loading library libocr.so
06-02 22:43:53.387 30258-30419/pzy64.searchbot I/Vision: libocr.so library load status: false
06-02 22:43:53.410 30258-30419/pzy64.searchbot I/Vision: Loading library libocr.so
06-02 22:43:53.411 30258-30419/pzy64.searchbot I/Vision: libocr.so library load status: false
06-02 22:43:53.475 30258-30419/pzy64.searchbot I/Vision: Loading library libocr.so
06-02 22:43:53.475 30258-30419/pzy64.searchbot I/Vision: libocr.so library load status: false
................... ..............
................... ..............
06-02 22:51:08.364 14970-3424/? I/Vision: Finished download ocr_armeabi_v7a.zip
06-02 22:51:08.421 14970-3424/? I/Vision: Unzipping /data/data/com.google.android.gms/cache/downloadservice/ocr_armeabi_v7a.zip to /data/data/com.google.android.gms/files/com.google.android.gms.vision/ocr
06-02 22:51:08.645 14970-3424/? I/Vision: Time to download ocr: 436558
06-02 22:51:09.142 3303-3489/pzy64.searchbot I/Vision: Loading library libocr.so
06-02 22:51:09.149 3303-3489/pzy64.searchbot I/Vision: libocr.so library load status: true
06-02 22:51:09.149 3303-3489/pzy64.searchbot I/Vision: Reading ocr models from /data/data/com.google.android.gms/files/com.google.android.gms.vision/ocr/data/models
The app i'm working on
I do "Clear Data" of the Google Play Service app and it works!
I think you missed out adding the "meta-data" tag in manifest file of your application. This meta-data tag tells your application to download and integrate the library to your application. Try adding a meta-data tag in your "application" tag above "activity" tag in the manifest file. See below:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
<meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="barcode"/>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
This might solve your issue.
I don't know if I am too late, but guys, after hours of challenges for me the problem was solved by Updating Google Play Services to version (12.6.85). I restarted the device and guess what? The app worked fine.
For updating this Google play service these instructions.
after some trials I figured out that in the gradle file you have to add these lines, too:
compile 'com.android.support:support-v4:24+'
compile 'com.android.support:design:24+'
So apart from this one
compile 'com.google.android.gms:play-services-vision:10.2.1'
the other two lines are important, too.
I had the exact same problem. As soon as I logged in to Google Play service then it downloaded and the barcode detector worked in the camera.

Android Development: Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY

I am trying to develop an app for Android. When I try to run it, I get this in the console:
[2012-05-16 11:49:52 - LDAPLookUp]
Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2012-05-16 11:49:52 - LDAPLookUp] Please check logcat output for more details.
[2012-05-16 11:49:52 - LDAPLookUp] Launch canceled!
And, in LogCat, there is this:
05-16 11:49:51.169: E/PackageManager(91):
Package com.ericbrian.ldaplookup requires unavailable shared library
com.unboundid.android.ldap.*; failing!
05-16 11:49:51.169: W/PackageManager(91):
Package couldn't be installed in /data/app/com.ericbrian.ldaplookup-2.apk
In the Referenced Libraries, I have unboundid-ldapsdk-se.jar.
In the manifest, I have:
<application
android:icon="#drawable/logo"
android:label="#string/app_name"
android:logo="#drawable/logo" >
<uses-library
android:name="com.unboundid.android.ldap.*" />
... snip ...
</application>
What am I missing to get this to work?
Thanks
What am I missing to get this to work?
You need to delete the <uses-library> element. That is not used for third-party JARs.
You also need to ensure that your third-party JAR is in in your project's libs/ directory, creating that directory if needed. That will automatically add the JAR to your build path, and so you can get rid of whatever you did to manually add it to "Referenced Libraries".

How to add system permission file/system library to Android

I am attempting to follow Diane Hackborn's request:
For a permission that allows an application to be root, it is okay to
add the permission to the framework
<...>. However, there still must be
some kind of shared library (even if
it is a stub) for the application to
request along with it, and the package
manager should not allow the
application get this permission unless
they also request the shared library.
So I used the sdk's sample example of TicTacToe:
exported com.example.android.tictactoe.library to a /data/app/TTTLib.jar
added /system/etc/permissions/com.example.android.tictactoe.library.xml with lines:
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<library name="com.example.android.tictactoe.library"
file="/data/app/TTTLib.jar" />
</permissions>
And compile com.example.android.tictactoe.MainActivity by adding a class folder pointing to the library but not adding the library itself to the .apk
It compiles, installs, starts running, but at the point when a library class were called crashes with error msg:
W/dalvikvm( 464): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
E/AndroidRuntime( 464): FATAL EXCEPTION: main
E/AndroidRuntime( 464): java.lang.NoClassDefFoundError: com.example.android.tictactoe.library.GameActivity
E/AndroidRuntime( 464): at com.example.android.tictactoe.MainActivity.startGame(MainActivity.java:51)
E/A
What do I miss? Thanks for your help.
In AndroidManifest.xml you have to enter the library dependency such as
<uses-library android:name="com.example.android.tictactoe.library"/>
Also i think you have to DEX the jar content before uploading it to the device, similar to the uploading of scala library to the device.
See http://lampwww.epfl.ch/~michelou/android/emulator-android-sdk.html and
http://lampwww.epfl.ch/~michelou/android/android-examples-in-scala/android-sdk.zip
for scripts that dexes the jar into dexed jar :)
Hope it does make any sense.
Check bin/createdexlibs in android-sdk.zip
Basically it should be something like
~/android-sdks/platform-tools/dx --dex --output=TTTLib.jar TTLLib_input.jar

Categories

Resources