File not found exception while downloading android expansion file - android

I'm creating a cordova plugin to download expansion files.
Currently, I'm implementing that the expansion files will be downloaded manually.
The request will be send, but I get the error
aborting request for download main.1000004.my.name.app.obb: while writing destination file: java.io.FileNotFoundException: /storage/emulated/0/Android/obb/my.name.app/main.1000004.my.name.app.obb.tmp: open failed: ENOENT (No such file or directory)
02-20 17:12:12.930 15355-15631/my.name.app W/System.err: com.google.android.vending.expansion.downloader.impl.DownloadThread$StopRequest: while writing destination file: java.io.FileNotFoundException: /storage/emulated/0/Android/obb/my.name.app/main.1000004.my.name.app.obb.tmp: open failed: ENOENT (No such file or directory)
W/System.err: at com.google.android.vending.expansion.downloader.impl.DownloadThread.writeDataToDestination(DownloadThread.java:515)
W/System.err: at com.google.android.vending.expansion.downloader.impl.DownloadThread.transferData(DownloadThread.java:350)
W/System.err: at com.google.android.vending.expansion.downloader.impl.DownloadThread.executeDownload(DownloadThread.java:308)
W/System.err: at com.google.android.vending.expansion.downloader.impl.DownloadThread.run(DownloadThread.java:236)
W/System.err: at com.google.android.vending.expansion.downloader.impl.DownloaderService.onHandleIntent(DownloaderService.java:1086)
W/System.err: at com.google.android.vending.expansion.downloader.impl.CustomIntentService$ServiceHandler.handleMessage(CustomIntentService.java:104)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err: at android.os.Looper.loop(Looper.java:148)
W/System.err: at android.os.HandlerThread.run(HandlerThread.java:61)
W/System.err: Caused by: java.io.FileNotFoundException: /storage/emulated/0/Android/obb/my.name.app/main.1000004.my.name.app.obb.tmp: open failed: ENOENT (No such file or directory)
W/System.err: at libcore.io.IoBridge.open(IoBridge.java:452)
W/System.err: at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
W/System.err: at java.io.FileOutputStream.<init>(FileOutputStream.java:127)
W/System.err: at com.google.android.vending.expansion.downloader.impl.DownloadThread.writeDataToDestination(DownloadThread.java:496)
W/System.err: ... 8 more
W/System.err: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
W/System.err: at libcore.io.Posix.open(Native Method)
W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
0W/System.err: at libcore.io.IoBridge.open(IoBridge.java:438)
Actually, my current main expansion version is 1000013. But it searches for 1000004. The content is the same, so it's not the problem.
The rights should be available
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Any idea why this could happen?

I believe that this is happening because the Google Play Console does not have a correct expansion file associated with your current version code. Make sure that you uploaded and selected a correct expansion file along with your APK in Play Console.
If it doesn't help, check if your external storage can be mounted by calling Helpers.isExternalMediaMounted(). Your device may not have an SD card (emulator?). Additionally, you may want to check if your app has access to the OBB directory by calling Helpers.canWriteOBBFile(Context).
I recommend using the updated Downloader Library included in Better APK Expansion package. It has several issues fixed and also provides simplified API that minimizes chances to shoot yourself in the foot.

If you reach here and didn't find an answer then please try add this to Mainfests <application android:requestLegacyExternalStorage="true" ... >

Related

W/System.err: java.io.FileNotFoundException:ENOENT (No such file or directory)

Not sure how to correct this error. I tried changing the manifest file but still didn't get any result. Also tried using various methods suggested in the site. But it didn't work as well. I don't know if it's about the sdk version as I'm using Android 12. But the same code still worked on the tutorial.
[![Manifest file][1]][1]
[![Manifest][2]][2]
//The Save button
val saveButton:ImageButton = findViewById(R.id.ib_save)
saveButton.setOnClickListener{
if(isReadStorageAllowed()){
val fl_container:FrameLayout = findViewById(R.id.fl_container)
lifecycleScope.launch{
saveFileFromBitmap(getBitmapFromView(fl_container))
}
}
}
The error messages in the log keeps pointing to this code:
private suspend fun saveFileFromBitmap(mBitMap:Bitmap?): String{
var result = ""
withContext(Dispatchers.IO){
if(mBitMap != null){
try {
val byte = ByteArrayOutputStream()
mBitMap.compress(Bitmap.CompressFormat.PNG,90, byte)
val f = File(externalCacheDir?.absoluteFile.toString() +
File.pathSeparator +
"KidsDrawingApp_" + System.currentTimeMillis()/1000, ".jpg")
val fo = FileOutputStream(f)
fo.write(byte.toByteArray())
fo.close()
result = f.absolutePath
runOnUiThread{
if (!result.isEmpty()){
Toast.makeText(this#MainActivity,
"Saved Successfully + $result",Toast.LENGTH_SHORT).show()
}else{
Toast.makeText(this#MainActivity,
"Something went wrong while saving", Toast.LENGTH_SHORT).show()
}
}
}
catch (e:Exception){
result = ""
e.printStackTrace()
}
}
}
return result
}```
Stacktrace:
2021-12-10 15:00:56.448 19068-19145/com.example.drawingapp W/System.err: java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.example.drawingapp/cache:KidsDrawingApp_1639128656/.jpg: open failed: ENOENT (No such file or directory)
2021-12-10 15:00:56.449 19068-19145/com.example.drawingapp W/System.err: at libcore.io.IoBridge.open(IoBridge.java:575)
2021-12-10 15:00:56.449 19068-19145/com.example.drawingapp W/System.err: at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
2021-12-10 15:00:56.449 19068-19145/com.example.drawingapp W/System.err: at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
2021-12-10 15:00:56.449 19068-19145/com.example.drawingapp W/System.err: at com.example.drawingapp.MainActivity$saveFileFromBitmap$2.invokeSuspend(MainActivity.kt:171)
2021-12-10 15:00:56.449 19068-19145/com.example.drawingapp W/System.err: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2021-12-10 15:00:56.449 19068-19145/com.example.drawingapp W/System.err: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
2021-12-10 15:00:56.449 19068-19145/com.example.drawingapp W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
2021-12-10 15:00:56.449 19068-19145/com.example.drawingapp W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
2021-12-10 15:00:56.449 19068-19145/com.example.drawingapp W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
2021-12-10 15:00:56.449 19068-19145/com.example.drawingapp W/System.err: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
2021-12-10 15:00:56.450 19068-19145/com.example.drawingapp W/System.err: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
2021-12-10 15:00:56.450 19068-19145/com.example.drawingapp W/System.err: at libcore.io.Linux.open(Native Method)
2021-12-10 15:00:56.450 19068-19145/com.example.drawingapp W/System.err: at libcore.io.ForwardingOs.open(ForwardingOs.java:567)
2021-12-10 15:00:56.450 19068-19145/com.example.drawingapp W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:273)
2021-12-10 15:00:56.451 19068-19145/com.example.drawingapp W/System.err: at libcore.io.ForwardingOs.open(ForwardingOs.java:567)
2021-12-10 15:00:56.451 19068-19145/com.example.drawingapp W/System.err: at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7725)
2021-12-10 15:00:56.451 19068-19145/com.example.drawingapp W/System.err: at libcore.io.IoBridge.open(IoBridge.java:561)
2021-12-10 15:00:56.451 19068-19145/com.example.drawingapp W/System.err: ... 9 more
I cannot figure out what the problem is with this code and I've searched all the internet. Please help me out and thanks in advance.
[1]: https://i.stack.imgur.com/J1eZI.png
[2]: https://i.stack.imgur.com/o5XWu.png
Look at the first line in your stacktrace:
java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.example.drawingapp/cache:KidsDrawingApp_1639128656/.jpg: open failed: ENOENT (No such file or directory)
It's telling you the path of the file you're trying to open, and KidsDrawingApp_1639128656/.jpg (i.e. a file called .jpg in a directory called KidsDrawingApp_1639128656) probably isn't what you wanted, right?
In your File constructor you're passing two Strings as parameters - here's what that one does:
Otherwise the parent pathname string is taken to denote a directory, and the child pathname string is taken to denote either a directory or a file.
You probably just wanted to append .jpg to the path you're building, instead of passing it as the child parameter
"KidsDrawingApp_" + System.currentTimeMillis()/1000 + ".jpg"
// or you can do this in Kotlin
"KidsDrawingApp_${System.currentTimeMillis()/1000}.jpg"

How to fix java.lang.SecurityException warning?

I have this exception in my app, under warnings in the Logcat.
The app is a system app.
java.lang.reflect.InvocationTargetException
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at netchanger.tawkon.com.lib.network.NetworkChanger.setPreferredNetwork(NetworkChanger.java:48)
W/System.err: at netchanger.tawkon.com.lib.network.NetworkChanger.setPreferredNetwork(NetworkChanger.java:36)
W/System.err: at netchanger.tawkon.com.lib.services.LocationMonitorService.stopService(LocationMonitorService.java:57)
W/System.err: at com.tawkon.data.lib.service.KeepAliveService$PowerReceiver.onReceive(KeepAliveService.java:154)
W/System.err: at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52497(LoadedApk.java:1313)
W/System.err: at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4)
W/System.err: at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39)
W/System.err: at android.os.Handler.handleCallback(Handler.java:790)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err: at android.os.Looper.loop(Looper.java:164)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6494)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
W/System.err: Caused by: java.lang.SecurityException: No Carrier Privilege.
W/System.err: at android.os.Parcel.readException(Parcel.java:2005)
W/System.err: at android.os.Parcel.readException(Parcel.java:1951)
W/System.err: at com.android.internal.telephony.ITelephony$Stub$Proxy.setPreferredNetworkType(ITelephony.java:4237)
W/System.err: at android.telephony.TelephonyManager.setPreferredNetworkType(TelephonyManager.java:4821)
W/System.err: ... 15 more
I see that this is InvocationTargetException and it's caused by SecurityException.
What does 'No Carrier Privilege.' mean? How can I avoid this?
Security Exception implies there is a permission required to which the user hasn't granted. Ensure you request for the correct permission and confirm that the user has granted the permission before execution of the functionality.
Read on telephony manager
As per the android documentation in order to use android.telephony.TelephonyManager.setPreferredNetworkType() method your app should have carrier privileges.
Carrier Privileges in a gist:
Android grants special privileges to apps from Mobile (Virtual) Network Operator (MNO/MVNOs) via UICC to override certain carrier configurations (e.g. IMS settings) on the device. This app from operator is signed with a signing key whose hash value is stored in UICC, which is in-turn read by Android Platform to allow the app to make calls to handful of special APIs
More information related to how to give your app carrier privileges can be found here. The link explains the method to override IMS settings using carrier privileges but it can be applied to whatever functionality you are trying to achieve

Class Not Found Exception using custom cordova plugin

I'm developing a printing app that uses a custom API to access the printer via USB, so I needed a custom Cordova plugin. I started developing it, it has been a very good challenge but also very frustrating at the moment because I can't figure out why my plugin can't be used correctly.
The thing is:
1.- The plugin installs correctly and lets me build the application
2.- The Javascript code runs correctly
3.- I get a runtime error that doesn't crash the app. It seems like the Java code is skipped. And I noticed there was an error in the Android Monitor.
You can find my plugin here:
https://github.com/krlozadan/cordova-custom-printer-plugin
W/System.err: java.lang.ClassNotFoundException: com.duplou.cordova.plugin.customprinter.CustomPrinter
W/System.err: at java.lang.Class.classForName(Native Method)
W/System.err: at java.lang.Class.forName(Class.java:324)
W/System.err: at java.lang.Class.forName(Class.java:285)
W/System.err: at org.apache.cordova.PluginManager.instantiatePlugin(PluginManager.java:489)
W/System.err: at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:169)
W/System.err: at org.apache.cordova.PluginManager.exec(PluginManager.java:122)
W/System.err: at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)
W/System.err: at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
W/System.err: at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err: at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err: at android.os.Looper.loop(Looper.java:148)
W/System.err: at android.os.HandlerThread.run(HandlerThread.java:61)
W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.duplou.cordova.plugin.customprinter.CustomPrinter" on path: DexPathList[[zip file "/data/app/1/lib/1/base.apk!/lib/x86, /vendor/lib, /system/lib]]
W/System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
W/System.err: ... 13 more
W/System.err: Suppressed: java.lang.ClassNotFoundException: com.duplou.cordova.plugin.customprinter.CustomPrinter
W/System.err: at java.lang.Class.classForName(Native Method)
W/System.err: at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
W/System.err: at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
W/System.err: ... 14 more
W/System.err: Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
I/System.out: Error adding plugin com.duplou.cordova.plugin.customprinter.CustomPrinter.
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CordovaPlugin.privateInitialize(java.lang.String, org.apache.cordova.CordovaInterface, org.apache.cordova.CordovaWebView, org.apache.cordova.CordovaPreferences)' on a null object reference
W/System.err: at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:171)
W/System.err: at org.apache.cordova.PluginManager.exec(PluginManager.java:122)
W/System.err: at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)
W/System.err: at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
W/System.err: at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err: at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err: at android.os.Looper.loop(Looper.java:148)
W/System.err: at android.os.HandlerThread.run(HandlerThread.java:61)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-custom-printer-plugin/www/custom-printer.js: Line 11 : Se terminó la ejecución
I/chromium: [INFO:CONSOLE(11)] "Se terminó la ejecución", source: file:///android_asset/www/plugins/cordova-custom-printer-plugin/www/custom-printer.js (11)
D/CordovaWebViewImpl: onPageFinished(file:///android_asset/www/index.html)
W/PluginManager: THREAD WARNING: exec() call to Sim.getSimInfo blocked the main thread for 53ms. Plugin should use CordovaInterface.getThreadPool().
D/SystemWebChromeClient: file:///android_asset/www/build/main.js: Line 1436 : ERROR
I/chromium: [INFO:CONSOLE(1436)] "ERROR", source: file:///android_asset/www/build/main.js (1436)
W/BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 12139
D/EGL_emulation: eglMakeCurrent: 0xae414a40: ver 2 0 (tinfo 0xa14bfbe0)
Here's my ionic info output
global packages:
#ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0
local packages:
#ionic/app-scripts : 1.3.7
#ionic/cli-plugin-cordova : 1.4.1
#ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.2.1
System:
Node : v6.10.3
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.10
I see that you are pointing to a jar file in your config.xml. If you really want to keep using this jar file make sure that the path is correctly mapped in android platform folders and it matches the classpath.
If you want to do a simple test, you should declare your android source files one by one. So after the node config-file you should add several nodes like this one:
<source-file src="src/android/src/net/mydomain/myplugin/MyClass.java" target-dir="src/mydomain/myplugin" />
This is the most important part of your stacktrace:
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.duplou.cordova.plugin.customprinter.CustomPrinter"
Your Cordova configuration references the CustomPrinter plugin. When Javascript triggers loading it, the Java class cannot be found and thus your application crashes.
You need to ensure that the Java class is present in your application package.
I have this error and solved it by change android.json file in \platforms\android\android.json
You must change value of
res/xml/config.xml to your package of custom Plugin.
The reason is package of your custom plugin and value of above in not same.
In my case I had multiple .java files referenced. When I changed the ordering of how it is referenced in plugin.xml, it fixed the problem. Seems like the last .java file is dependent on the second last one.
Before:
<!--libs-->
<source-file src="libs/sample-release.aar" target-dir="libs/" />
<source-file src="src/android/Licence.java" target-dir="src/android/" />
<source-file src="src/android/Deserializer.java" target-dir="src/android/" />
After:
<!--libs-->
<source-file src="libs/sample-release.aar" target-dir="libs/" />
<source-file src="src/android/Deserializer.java" target-dir="src/android/" />
<source-file src="src/android/Licence.java" target-dir="src/android/" />
So just by switching the ordering, the ClassNotFoundException was resolved.

Strange error in Android 6.0.1

E/ItsOnOemAPI: Send local socket ADD_MEDIA_MAPPING failed
java.io.IOException: No such file or directory
at android.net.LocalSocketImpl.connectLocal(Native Method)
at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:290)
at android.net.LocalSocket.connect(LocalSocket.java:130)
at com.itsoninc.android.ItsOnOemApi.sendLocalSocket(ItsOnOemApi.java:265)
at com.itsoninc.android.ItsOnOemApi.registerMediaMapping(ItsOnOemApi.java:245)
at java.lang.reflect.Method.invoke(Native Method)
at android.media.MediaPlayer.registerMediaMapping(MediaPlayer.java:1273)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1204)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1164)
at com.pakistantechhouse.quranmp3pro.activities.Start$MP1.doInBackground(Start.java:3138)
at com.pakistantechhouse.quranmp3pro.activities.Start$MP1.doInBackground(Start.java:3111)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
I am getting the above error while playing a mp3 file from internet same code is working on later versions of android and also on 6.0 on most of the devices but on my test device(Samsung Galaxy note Edge SP-N915P) its giving me the above error and not playing the media files.

Confused why these errors are happening, and what they mean?

I'm messing around with DBFlow in a android app trying to learn the framework a bit, and I've started getting errors, though I'm not sure they are related to DBFlow.
Here is the error messages:
01-12 06:49:43.817 1294-1310/? E/BluetoothAdapter: Bluetooth binder is null
01-12 06:49:43.818 1294-1310/? E/KernelCpuSpeedReader: Failed to read cpu-freq
java.io.FileNotFoundException: /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:452)
at java.io.FileInputStream.<init>(FileInputStream.java:76)
at java.io.FileInputStream.<init>(FileInputStream.java:103)
at java.io.FileReader.<init>(FileReader.java:66)
at com.android.internal.os.KernelCpuSpeedReader.readDelta(KernelCpuSpeedReader.java:49)
at com.android.internal.os.BatteryStatsImpl.updateCpuTimeLocked(BatteryStatsImpl.java:8002)
at com.android.server.am.BatteryStatsService.updateExternalStats(BatteryStatsService.java:1366)
at com.android.server.am.BatteryStatsService$BatteryStatsHandler.handleMessage(BatteryStatsService.java:125)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:438)
at java.io.FileInputStream.<init>(FileInputStream.java:76) 
at java.io.FileInputStream.<init>(FileInputStream.java:103) 
at java.io.FileReader.<init>(FileReader.java:66) 
at com.android.internal.os.KernelCpuSpeedReader.readDelta(KernelCpuSpeedReader.java:49) 
at com.android.internal.os.BatteryStatsImpl.updateCpuTimeLocked(BatteryStatsImpl.java:8002) 
at com.android.server.am.BatteryStatsService.updateExternalStats(BatteryStatsService.java:1366) 
at com.android.server.am.BatteryStatsService$BatteryStatsHandler.handleMessage(BatteryStatsService.java:125) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
at com.android.server.ServiceThread.run(ServiceThread.java:46) 
01-12 06:49:43.818 1294-1310/? E/KernelUidCpuTimeReader: Failed to read uid_cputime
java.io.FileNotFoundException: /proc/uid_cputime/show_uid_stat: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:452)
at java.io.FileInputStream.<init>(FileInputStream.java:76)
at java.io.FileInputStream.<init>(FileInputStream.java:103)
at java.io.FileReader.<init>(FileReader.java:66)
at com.android.internal.os.KernelUidCpuTimeReader.readDelta(KernelUidCpuTimeReader.java:71)
at com.android.internal.os.BatteryStatsImpl.updateCpuTimeLocked(BatteryStatsImpl.java:8031)
at com.android.server.am.BatteryStatsService.updateExternalStats(BatteryStatsService.java:1366)
at com.android.server.am.BatteryStatsService$BatteryStatsHandler.handleMessage(BatteryStatsService.java:125)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:438)
at java.io.FileInputStream.<init>(FileInputStream.java:76) 
at java.io.FileInputStream.<init>(FileInputStream.java:103) 
at java.io.FileReader.<init>(FileReader.java:66) 
at com.android.internal.os.KernelUidCpuTimeReader.readDelta(KernelUidCpuTimeReader.java:71) 
at com.android.internal.os.BatteryStatsImpl.updateCpuTimeLocked(BatteryStatsImpl.java:8031) 
at com.android.server.am.BatteryStatsService.updateExternalStats(BatteryStatsService.java:1366) 
at com.android.server.am.BatteryStatsService$BatteryStatsHandler.handleMessage(BatteryStatsService.java:125) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
at com.android.server.ServiceThread.run(ServiceThread.java:46)
I'm pretty new to Android development and confused why they are occurring. It is not crashing my application, and doesn't appear to happen every single time.
By the way, I'm using the Nexus 5 Emulator to run this, so maybe it's related to that? Usually errors are bad, so I'm assuming this is something to be concerned with, regardless of it not appearing to effect the app...?
Maybe you need permision read/write Files
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
You are refering to the DBFlow framework. Well DBFlow is probably just a library to interact with a DB. Now the real question is do you know if your app has permission to read each of those files? What you see in command line vs app are not the same. I believe in the emulator you run as root. As for your app you are not root. Try checking what permissions your app has with respect to that File via the File APIs
If you use lib LeakCanary that happens because the lib writes of the leaks on your external storage, if you use the android API 23 and higher you will be asked for permission runtime, but dont have that permission in Manifest file.

Categories

Resources