Facing this problem while trying to implement JaCoCo Offline Instrumentation.
W/System.err( 1733): java.io.FileNotFoundException: /jacoco.exec: open failed: EROFS (Read-only file system)
W/System.err( 1733): at libcore.io.IoBridge.open(IoBridge.java:456)
W/System.err( 1733): at java.io.FileOutputStream.<init>(FileOutputStream.java:89)
--
W/System.err( 1733): at libcore.io.IoBridge.open(IoBridge.java:456)
W/System.err( 1733): at java.io.FileOutputStream.<init>(FileOutputStream.java:89)
W/System.err( 1733): at org.jacoco.agent.rt.internal_14f7ee5.output.FileOutput.openFile(FileOutput.java:67)
W/System.err( 1733): at org.jacoco.agent.rt.internal_14f7ee5.output.FileOutput.startup(FileOutput.java:49)
W/System.err( 1733): at org.jacoco.agent.rt.internal_14f7ee5.Agent.startup(Agent.java:122)
W/System.err( 1733): at org.jacoco.agent.rt.internal_14f7ee5.Agent.getInstance(Agent.java:50)
W/System.err( 1733): at org.jacoco.agent.rt.internal_14f7ee5.Offline.<clinit>(Offline.java:31)
The solution is well-documented in jacoco but for Android people, what you need is to add the file in /src/androidTest/resources/jacoco-agent.properties with the contents output=none so jacoco can startup without failing, and coverage will be written as normal and transferred correctly later by the android gradle plugin coverage implementation.
I think it's safe to ignore that offline instrumentation warning, because the path should be something alike: executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec") (on the PC - so there is no need to save it on the device and then pull the file).
On Android this will add the JaCoCo agent into the APK:
buildTypes {
debug {
testCoverageEnabled = true
}
}
Related
I created a very basic Nativescript Android app that uses the nativescript-barcodescanner plugin. The app builds successfully but when it gets deployed on the emulator I get the following error. Any idea what I can do to resolve this or what could be causing this?
error:
java.lang.RuntimeException: Unable to resume activity {org.nativescript.barcodescanner/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
Calling js method onCreateView failed
Error: File /data/data/org.nativescript.barcodescanner/files/app/.components/information/information.component.html does not exist. Resolved from: .components/information/information.component.html.
File: "/data/data/org.nativescript.barcodescanner/files/app/tns_modules/nativescript-angular/resource-loader.js, line: 22, column: 12
StackTrace:
Frame: function:'FileSystemResourceLoader.get', file:'/data/data/org.nativescript.barcodescanner/files/app/tns_modules/nativescript-angular/resource-loader.js', line: 22, column: 19
Frame: function:'DirectiveNormalizer._fetch', file:'/data/data/org.nativescript.barcodescanner/files/app/tns_modules/#angular/compiler/bundles/compiler.umd.js', line: 13661, column: 45
Frame: function:'DirectiveNormalizer.normalizeTemplateAsync', file:'/data/data/org.nativescript.barcodescanner/files/
And the last few lines of my command prompt:
BUILD SUCCESSFUL
Total time: 1 mins 9.45 secs
Project successfully built
Successfully deployed on device with identifier '192.168.8.101:5555'.
W/System.err( 2258): at com.tns.Runtime.callJSMethodNative(Native Method)
W/System.err( 2258): at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:865)
W/System.err( 2258): at com.tns.Runtime.callJSMethodImpl(Runtime.java:730)
W/System.err( 2258): at com.tns.Runtime.callJSMethod(Runtime.java:716)
W/System.err( 2258): at com.tns.Runtime.callJSMethod(Runtime.java:697)
W/System.err( 2258): at com.tns.Runtime.callJSMethod(Runtime.java:687)
It seems that it can not find .components/information/information.component.html and prevents from resuming
the activity , maybe there is a problem with you relative path or something(like components instead of .components)
Cordova App breaks on Android lollipop, During app installation this is what i see in the logcat, though i am not sure if these are the actual cause of the error. (app installs/works fine on versions < 5.0)
using cordova v-5.1.1 & cordova-android#4.0.2
I/PersonaManagerService( 3485): PersonaId don't exist
I/ActivityManager( 3485): do not start freezing screen for locked container getKeyguardshowstate = false
E/Parcel ( 3485): Class not found when unmarshalling: com.android.packageinstaller.InstallFlowAnalytics
E/Parcel ( 3485): java.lang.ClassNotFoundException: com.android.packageinstaller.InstallFlowAnalytics
further downword in the logs i see this
D/ApplicationPolicy( 3485): isStatusBarNotificationAllowedAsUser: packageName = com.android.providers.downloads,userId = 0
V/ApplicationPolicy( 3485): isApplicationStateBlocked userId 0 pkgname com.android.providers.downloads
W/NotificationService( 3485): Pray mode not found android.content.pm.PackageManager$NameNotFoundException: Application package com.sec.android.settings.praymodewidget not found
I/PackageManager( 3485): do mInstaller.dexopt : 0
D/PackageManager( 3485): Time to dexopt: 1.389 seconds
W/System.err( 3485): java.io.FileNotFoundException: /data/app/com.TestApp.Test-1: open failed: EISDIR (Is a directory)
W/System.err( 3485): at libcore.io.IoBridge.open(IoBridge.java:456)
W/System.err( 3485): at java.io.FileInputStream.<init>(FileInputStream.java:76)
W/System.err( 3485): at android.content.pm.PackageParser.getHashValueOfPackage(PackageParser.java:5170)
W/System.err( 3485): at com.android.server.pm.PackageManagerService.saveHash(PackageManagerService.java:19974)
W/System.err( 3485): at com.android.server.pm.PackageManagerService.access$5800(PackageManagerService.java:352)
W/System.err( 3485): at com.android.server.pm.PackageManagerService$21.run(PackageManagerService.java:19959)
W/System.err( 3485): Caused by: android.system.ErrnoException: open failed: EISDIR (Is a directory)
W/System.err( 3485): at libcore.io.IoBridge.open(IoBridge.java:446)
W/System.err( 3485): ... 5 more
W/System.err( 3485): remove failed: ENOENT (No such file or directory) : /data/system/packages.xml.bak
W/System.err( 3485): remove failed: ENOENT (No such file or directory) : /data/system/users/0/package-restrictions.xml.bak
D/PackageManager( 3485): New package installed
Though the application then installs successfully but there are rendering issue's when i start the app.
In-case you need some other information on the error let me know.
I'm porting our application using QT to the Android platform. This is a kiosk-type application, the devices are rooted and we have full control over them. In order to modify some system settings (networking in particular), our app needs to be installed as a system app. To accomplish this, I use the following commands in an adb shell (after an adb remount):
1) pm install /data/my_app.apk
2) rm /data/my_app.apk
3) cp -p /data/app/com.me.my_app-1.apk /system/app
4) rm /data/app/com.me.my_app-1.apk
5) cp -p /data/app-lib/com.me.my_app-1/* /system/lib
6) rm -rf /data/app-lib/com.me.my_app-1
7) rm /data/data/com.me.my_app/lib
8) ln -s /system/lib /data/data/com.me.my_app/lib
9) reboot
After the reboot, when I launch the application I get a message box:
"Your application encountered a fatal error and cannot continue."
logcat shows the following exception and stack trace:
I/Qt ( 1272): qt start
D/dalvikvm( 1272): No JNI_OnLoad found in /system/lib/libmy_app.so 0x411f0a08, skipping init
W/System.err( 1272): java.lang.Exception: Can't find main library 'my_app'
W/System.err( 1272): at org.qtproject.qt5.android.QtNative.startApplication(QtNative.java:196)
W/System.err( 1272): at org.qtproject.qt5.android.QtActivityDelegate.startApplication(QtActivityDelegate.java:635)
W/System.err( 1272): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1272): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1272): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:252)
W/System.err( 1272): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:643)
W/System.err( 1272): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:872)
W/System.err( 1272): at android.app.Activity.performCreate(Activity.java:5104)
W/System.err( 1272): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
W/System.err( 1272): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
W/System.err( 1272): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
W/System.err( 1272): at android.app.ActivityThread.access$600(ActivityThread.java:141)
W/System.err( 1272): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
W/System.err( 1272): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 1272): at android.os.Looper.loop(Looper.java:137)
W/System.err( 1272): at android.app.ActivityThread.main(ActivityThread.java:5041)
W/System.err( 1272): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1272): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1272): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
W/System.err( 1272): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
W/System.err( 1272): at dalvik.system.NativeStart.main(Native Method)
W/System.err( 1272): java.lang.Exception:
W/System.err( 1272): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:253)
W/System.err( 1272): at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:643)
W/System.err( 1272): at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:872)
W/System.err( 1272): at android.app.Activity.performCreate(Activity.java:5104)
W/System.err( 1272): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
W/System.err( 1272): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
W/System.err( 1272): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
W/System.err( 1272): at android.app.ActivityThread.access$600(ActivityThread.java:141)
W/System.err( 1272): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
W/System.err( 1272): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 1272): at android.os.Looper.loop(Looper.java:137)
W/System.err( 1272): at android.app.ActivityThread.main(ActivityThread.java:5041)
W/System.err( 1272): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 1272): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 1272): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
W/System.err( 1272): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
W/System.err( 1272): at dalvik.system.NativeStart.main(Native Method)
libmy_app.so is located in /system/lib along with all the other QT libraries (libQt5AndroidExtras.so, libQt5Widgets.so, etc)
Googling for "Can't find main library" has led me to the QT source but that hasn't been helpful in tracking down why it can't find the library.
So any insight as to what's going on would be appreciated. Or if there a a better, totally different solution to running a QT app as a system app, I'm open to that too.
Thanks in advance!
UPDATE
After some more investigation, it appears the problem is because QTNative.startApplication() is using nativeLibraryPath to look for libmy_app.so. nativeLibraryPath is defined in /data/system/packages.xml:
<package name="com.me.my_app" codePath="/system/app/com.me.my_app-1.apk" nativeLibraryPath="/data/app-lib/com.me.my_app-1" flags="572999" ft="1471c4d74c0" it="1471c4d7c39" ut="1471c4d7c39" version="1" userId="10063">
but /data/app-lib/com.me.my_app-1 doesn't exist when my_app is a system app. My first though was it's because I removed it in step 6 after moving the libraries to the /system/lib folder. But even leaving that step out, after rebooting the device /data/app-lib/com.me.my_app-1 is gone. I guess some Android package management process cleaned it up. If I create a symlink from /data/app-lib/com.me.my_app-1 point to /system/lib after the reboot, my application runs.
So my question at this point is what is nativeLibraryPath in packages.xml used for? It appears that Android searches for libraries via /data/data/com.me.my_app/lib, which is a symlink to either /data/app-lib/com.me.my_app-1 or /system/lib depending if it's a user or system app. And I figured this out because if I don't move the Qt libraries to /system/lib and change the symlink (steps 5, 7 and 8) my application throws an exception even earlier because Android can't find the QT libraries.
But it appears QT is using the value of nativeLibraryPath from packages.xml to find my library. Is changing it to /system/lib the correct solution? Are there any other potential side effects? Or is this a misbehaviour on QT's part and it should use the same search path as the rest of Android?
I think the right solution is recreating the symlink from /data/app-lib/com.me.my_app-1 to /system/lib after the reboot. It's only removed on the first reboot after moving the app to the system folder and is stable from that point across reboots and app updates. So I'm going to mark this as the answer in case anyone else runs into the same problem. For reference, the process I ended up with to install a QT app as a system app from the adb shell is:
1) pm install /data/my_app.apk
2) rm /data/my_app.apk
3) cp -p /data/app/com.me.my_app-1.apk /system/app
4) rm /data/app/com.me.my_app-1.apk
5) cp -p /data/app-lib/com.me.my_app-1/* /system/lib
6) rm /data/data/com.me.my_app/lib
7) ln -s /system/lib /data/data/com.me.my_app/lib
8) reboot
Start the adb shell again and then:
9) ln -s /system/lib /data/app-lib/com.me.my_app-1
You can use this patchset as a temporary solution: https://codereview.qt-project.org/194507
All libraries from android-build/libs/ must be deployed at /system/lib folder on device (or firmware before it built)
I am new to android and I am trying to explore the AccessibilityService. I have extended the AccessibilityService class, which gets the AccessibilityEvents and I am able to use the events.
I see a problem when I run "uiautomator dump". My AccessibilityService gets destroyed and I do not get any Accessibility Events. Is there a way to work around this problem?
Any help or suggestion appreciated. Thank you very much in advance.
The stack trace is attached below:
W/System.err( 3832): at com.example.myservice.MyAccessibilityService.onUnbind(MyAccessibilityService.java:185)
W/System.err( 3832): at android.app.ActivityThread.handleUnbindService(ActivityThread.java:2629)
W/System.err( 3832): at android.app.ActivityThread.access$1800(ActivityThread.java:141)
W/System.err( 3832): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1348)
W/System.err( 3832): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 3832): at android.os.Looper.loop(Looper.java:137)
W/System.err( 3832): at android.app.ActivityThread.main(ActivityThread.java:5103)
W/System.err( 3832): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 3832): at java.lang.reflect.Method.invoke(Method.java:525)
W/System.err( 3832): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
W/System.err( 3832): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
W/System.err( 3832): at dalvik.system.NativeStart.main(Native Method)
UiAutomator can't be used along with an AccessibilityService. When you turn on the service the uiAutomator will crash.
However, as UiAutomator 2.0 is based on instrumentation you will probably be able to access the information you need without the service.
I faced the same problem & just found out the solution from here.
The answer was written in Kotlin so I modified mine here as I am writing in Java:
int flags = UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES;
Configurator.getInstance().setUiAutomationFlags(flags);
mDevice = UiDevice.getInstance(getInstrumentation());
Please try with uiautomator2 having version above 18 and make disable supress accessibility service flag as true, which ll run accessibility service as well as driver seamlessly without terminating.
You could switch to UiAutmator2 with following code from appium-uiautomator2-server:
private void setAccessibilityServiceState() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
return;
}
Configurator.getInstance().setUiAutomationFlags(
UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES);
} else {
// We can disable UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES
// only when we set the value as zero
Configurator.getInstance().setUiAutomationFlags(0);
}
}
I was getting this failure on a ICS device with latest Google Play Services when trying to call GoogleAuthUtil.getToken(args). The issue was resolved by removing and adding Google account to the phone. I wasn't able to reproduce the error. Google searching stack trace provided no insights. Any ideas on how this issue could be prevented and what it means are appreciated!
W/System.err( 3145): java.lang.SecurityException: Permission Denial: reading com.google.android.gsf.gservices.GservicesProvider uri content://com.google.android.gsf.gservices/prefix from pid=3145, uid=10055 requires com.google.android.providers.gsf.permission.READ_GSERVICES
W/System.err( 3145): at android.os.Parcel.readException(Parcel.java:1327)
W/System.err( 3145): at android.os.Parcel.readException(Parcel.java:1281)
W/System.err( 3145): at com.google.android.gms.internal.a$a$a.a(Unknown Source)
W/System.err( 3145): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
W/System.err( 3145): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
W/System.err( 3145): at com.xxxxx.Backend.obtainSheetKeyAndInitService(Backend.java:112)
W/System.err( 3145): at com.xxxxx.Backend.fetchColumns(Backend.java:103)
W/System.err( 3145): at com.xxxxx.ProgressActivity$DummySectionFragment$3.doInBackground(ProgressActivity.java:288)
W/System.err( 3145): at com.xxxxx.ProgressActivity$DummySectionFragment$3.doInBackground(ProgressActivity.java:1)
W/System.err( 3145): at android.os.AsyncTask$2.call(AsyncTask.java:264)
W/System.err( 3145): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
W/System.err( 3145): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
W/System.err( 3145): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
W/System.err( 3145): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
W/System.err( 3145): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
W/System.err( 3145): at java.lang.Thread.run(Thread.java:856)
EDIT
As of time of reporting the bug:
google_play_services-lib android:versionName="3.2.65 (834000-30)"
Google Play Services version on device 4.0.31
Updated library to 4.0.30 and added requested permission to Manifest which seems to have worked. Waiting for Google to confirm that new library version fixes this issue because adding a new permission is a highly undesirable fix.
Bug report: http://code.google.com/p/android/issues/detail?id=61934
You should add
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
to the AndroidManifest.xml file. Thats all.
Today 2013-11-14 there has been a large drop in the number of error reports we have received due to this exception. Also I see Google Play Services version 4.0.33 is out, I didn't notice exactly when that released but it looks like yesterday.
Perhaps Google released a fix in 4.0.33? That would be great!
If anyone has been able to reproduce this bug, please let us know if 4.0.33 fixes it for you. (We have never been able to reproduce the bug on a dev device, although we have have zillions of traces from our installed base.)
[UPDATE] Google has definitely pushed a fix, we had only a handful of reports on 11/15 and zero on 11/16