Update:
I created an asset folder and inside of it is a century.ttf file. First I got a wrong encoding problem but after I followed these steps after File was loaded in the wrong encoding 'UTF-8' while pasting new font to Assets Folder in Android Studio the error message disappeared.
Then I wrote into my MainActivity:
FOURTH UPDATE:
Typeface typeface = Typeface.createFromAsset(getAssets(),"century.ttf");
Text.setTypeface(typrface);
But then my app suddenly stops.
FOURTH UPDATE:
09-08 20:17:54.742 1266-1301/? E/cutils: Failed to mkdir(/data/system/users/0): No such file or directory
09-08 20:17:54.742 1266-1301/? E/vold: Failed to prepare /data/system/users/0: No such file or directory
09-08 20:17:54.743 1266-1301/? E/vold: Failed to prepare user 0 storage
09-08 20:17:54.822 1266-1314/? E/Cryptfs: Bad magic for real block device /dev/block/vdd
09-08 20:17:54.742 1266-1301/? E/cutils: Failed to mkdir(/data/system/users/0): No such file or directory
09-08 20:17:54.742 1266-1301/? E/vold: Failed to prepare /data/system/users/0: No such file or directory
09-08 20:17:54.743 1266-1301/? E/vold: Failed to prepare user 0 storage
09-08 20:17:54.822 1266-1314/? E/Cryptfs: Bad magic for real block device /dev/block/vdd
09-08 20:17:56.997 1310-1310/? E/libEGL: load_driver(/system/lib/egl/libGLES_emulation.so): dlopen failed: library "/system/lib/egl/libGLES_emulation.so" not found
09-08 20:17:57.012 1266-1301/? E/vold: Failed to chmod /data/system_ce/0: No such file or directory
09-08 20:17:57.012 1266-1301/? E/vold: Failed to chmod /data/misc_ce/0: No such file or directory
09-08 20:17:57.012 1266-1301/? E/vold: Failed to chmod /data/media/0: No such file or directory
09-08 20:17:57.048 1310-1310/? E/SurfaceFlinger: hwcomposer module not found
09-08 20:17:57.851 1310-1326/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
09-08 20:17:57.853 1340-1345/? E/libEGL: load_driver(/system/lib/egl/libGLES_emulation.so): dlopen failed: library "/system/lib/egl/libGLES_emulation.so" not found
09-08 20:18:05.693 1266-1301/? E/vold: Failed to chmod /data/system_ce/0: No such file or directory
09-08 20:18:05.693 1266-1301/? E/vold: Failed to chmod /data/misc_ce/0: No such file or directory
09-08 20:18:05.693 1266-1301/? E/vold: Failed to chmod /data/media/0: No such file or directory
09-08 20:18:05.928 1405-1405/? E/cutils: Failed to read /data/.layout_version: No such file or directory
[ 09-08 20:18:05.928 1405: 1405 D/ ]
Assuming that device has multi-user storage layout; upgrade no longer supported
[ 09-08 20:18:05.928 1405: 1405 D/ ]
Upgrading to /data/misc/user directories
09-08 20:18:05.968 1416-1416/? E/perfprofd: unable to open configuration file /data/data/com.google.android.gms/files/perfprofd.conf
09-08 20:18:06.123 1403-1403/? E/EmulatedCamera_Factory: 2 cameras are being emulated. 0 of them are fake cameras.
09-08 20:18:06.123 1403-1403/? E/EmulatedCamera_HotplugThread: createFileIfNotExists: Could not create file '/data/misc/media/emulator.camera.hotplug.0', error: 'Permission denied' (13)
09-08 20:18:06.123 1403-1403/? E/EmulatedCamera_HotplugThread: createFileIfNotExists: Could not create file '/data/misc/media/emulator.camera.hotplug.1', error: 'Permission denied' (13)
09-08 20:18:06.123 1403-1403/? E/CameraService: setUpVendorTags: Vendor tag operations not fully defined. Ignoring definitions.
09-08 20:18:06.204 1402-1402/? E/RadioService: couldn't load radio module radio.primary (No such file or directory)
09-08 20:18:06.204 1402-1402/? E/SoundTriggerHwService: couldn't load sound trigger module sound_trigger.primary (No such file or directory)
09-08 20:18:07.021 1534-1534/? E/ipv6proxy: Failed to forward Neighbor Solicitation for fe80::5c01:45ff:fe1b:e65c from radio0-peer to eth0: Cannot assign requested address
09-08 20:18:07.039 1544-1544/? E/hostapd: Configuration file: /system/etc/simulated_hostapd.conf
09-08 20:18:07.308 1401-1401/? E/memtrack: Couldn't load memtrack module (No such file or directory)
09-08 20:18:07.308 1401-1401/? E/android.os.Debug: failed to load memtrack module: -2
09-08 20:18:07.695 1401-1401/? E/Typeface: Error mapping font file /system/fonts/DroidSansFallback.ttf
09-08 20:18:08.021 1534-1534/? E/ipv6proxy: Failed to forward Router Advertisement from eth0 to wlan1: Network is unreachable
09-08 20:18:08.021 1534-1534/? E/ipv6proxy: Failed to forward Router Advertisement from eth0 to radio0-peer: Cannot assign requested address
09-08 20:18:08.231 1411-1411/? E/Netd: cannot find interface dummy0
09-08 20:18:08.398 1401-1401/? E/libEGL: load_driver(/system/lib/egl/libGLES_emulation.so): dlopen failed: library "/system/lib/egl/libGLES_emulation.so" not found
09-08 20:18:08.423 1401-1401/? E/Hyphenator: error loading hyphenation /system/usr/hyphen-data/hyph-as.hyb
java.io.FileNotFoundException: /system/usr/hyphen-data/hyph-nb.hyb: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:455)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:247)
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:118)
at android.text.Hyphenator.init(Hyphenator.java:224)
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:252)
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:206)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743)
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:187)
at libcore.io.IoBridge.open(IoBridge.java:441)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:247)
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:118)
at android.text.Hyphenator.init(Hyphenator.java:224)
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:252)
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:206)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743)
09-08 20:18:08.430 1401-1401/? E/Hyphenator: error loading hyphenation /system/usr/hyphen-data/hyph-nn.hyb
java.io.FileNotFoundException: /system/usr/hyphen-data/hyph-nn.hyb: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:455)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:247)
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:118)
at android.text.Hyphenator.init(Hyphenator.java:224)
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:252)
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:206)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743)
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:187)
at libcore.io.IoBridge.open(IoBridge.java:441)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:247)
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:118)
at android.text.Hyphenator.init(Hyphenator.java:224)
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:252)
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:206)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743)
09-08 20:18:08.430 1401-1401/? E/Hyphenator: error loading hyphenation /system/usr/hyphen-data/hyph-or.hyb
java.io.FileNotFoundException: /system/usr/hyphen-data/hyph-or.hyb: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:455)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:247)
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:118)
at android.text.Hyphenator.init(Hyphenator.java:224)
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:252)
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:206)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743)
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:187)
at libcore.io.IoBridge.open(IoBridge.java:441)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:247)
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:118)
at android.text.Hyphenator.init(Hyphenator.java:224)
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:252)
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:206)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743)
09-08 20:18:08.430 1401-1401/? E/Hyphenator: error loading hyphenation /system/usr/hyphen-data/hyph-pa.hyb
java.io.FileNotFoundException: /system/usr/hyphen-data/hyph-pa.hyb: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:455)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:247)
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:118)
at android.text.Hyphenator.init(Hyphenator.java:224)
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:252)
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:206)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743)
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:187)
at libcore.io.IoBridge.open(IoBridge.java:441)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:247)
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:118)
at android.text.Hyphenator.init(Hyphenator.java:224)
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:252)
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:206)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743)
09-08 20:18:08.431 1401-1401/? E/Hyphenator: error loading hyphenation /system/usr/hyphen-data/hyph-pt.hyb
Process: com.example.fdai3744.t_online20, PID: 3050
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fdai3744.t_online20/com.example.fdai3744.t_online20.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setTypeface(android.graphics.Typeface)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setTypeface(android.graphics.Typeface)' on a null object reference
at com.example.fdai3744.t_online20.MainActivity.onCreate(MainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
FOURTH UPDATE:
Follow the instructions in the link below and go to the manifest file and add android:name="the-below-implementation" under application xml tag
https://github.com/chrisjenx/Calligraphy
Considering you use ttf fonts in asset folder, generate typeface like this.
Typeface typeface = Typeface.createFromAsset(getAssets(),"YourFontName.ttf");
Text.setTypeface(typrface);
Your code is requesting font/century (see: Caused by: java.lang.RuntimeException: Font asset not found font/century). The actual asset is font/century.tff (according to your comment), or possibly font/century.ttf (which would be the more likely file extension for TrueType fonts).
The font path you provide needs to match the actual path in assets/, including file extensions.
Try putting the ttf file into a "fonts" folder inside the "Assets" folder and then change the source path "fonts/century.ttf". My guess is that the file isn't being recognized as a font file.
This is how I have it set-up in one of my projects:
Related
I am trying to show interstitial ads on my app but I am getting this error and I am not even sure if this is the error that is causing my app to not load the ads...
pls, help...
E/WindowManager: android.view.WindowLeaked: Activity com.xyz.MainActivity has leaked window DecorView#d70cda7[MainActivity] that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:733)
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:717)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:399)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:109)
at android.app.Dialog.show(Dialog.java:340)
at com.itsmypac.xand0.MainActivity.Player1(MainActivity.java:137)
at com.itsmypac.xand0.MainActivity.onCreate(MainActivity.java:88)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
And I am also getting this error
E/.itsmypac.xand: Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/snapshot_blob_32.bin': No such file or directory
Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/snapshot_blob_64.bin': No such file or directory
Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/snapshot_blob_64.bin': No such file or directory
Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/icudtl.dat': No such file or directory
E/.itsmypac.xand: Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/chrome_100_percent.pak': No such file or directory
E/.itsmypac.xand: Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/stored-locales/en-US.pak': No such file or directory
I/chatty: uid=10168(com.itsmypac.xand0) identical 1 line
E/.itsmypac.xand: Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/stored-locales/en-US.pak': No such file or directory
Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/resources.pak': No such file or directory
E/.itsmypac.xand: Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/stored-locales/en-US.pak': No such file or directory
E/.itsmypac.xand: Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/snapshot_blob_32.bin': No such file or directory
E/.itsmypac.xand: Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/snapshot_blob_64.bin': No such file or directory
Failed to open file '/data/data/com.itsmypac.xand0/code_cache/.overlay/base.apk/assets/snapshot_blob_64.bin': No such file or directory
I have removed Android Studio v2.1 and installed version 3.1.1, but after installation, I try to run the code with emulator, However, the following error occurs within the LogCat section. May I ask is there any solutions for this ? I think this is somewhat related to my user name of the installed OS.
04-17 15:23:49.644 1267-1305/? E/vold: Failed to prepare /data/system/users/0: No such file or directory
Failed to prepare user 0 storage
04-17 15:23:49.802 1313-1313/? E/libEGL: load_driver(/system/lib/egl/libGLES_emulation.so): dlopen failed: library "/system/lib/egl/libGLES_emulation.so" not found
04-17 15:23:49.809 1267-1322/? E/Cryptfs: Bad magic for real block device /dev/block/vdd
04-17 15:23:49.859 1313-1313/? E/SurfaceFlinger: hwcomposer module not found
04-17 15:23:49.885 1313-1313/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
04-17 15:23:49.885 1267-1305/? E/vold: Failed to chmod /data/system_ce/0: No such file or directory
04-17 15:23:49.885 1313-1313/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
04-17 15:23:49.885 1267-1305/? E/vold: Failed to chmod /data/misc_ce/0: No such file or directory
Failed to chmod /data/media/0: No such file or directory
04-17 15:23:49.885 1313-1313/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
04-17 15:23:50.771 1313-1320/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
04-17 15:23:50.994 1341-1346/? E/libEGL: load_driver(/system/lib/egl/libGLES_emulation.so): dlopen failed: library "/system/lib/egl/libGLES_emulation.so" not found
04-17 15:24:06.261 1435-1435/? E/EmulatedCamera_Factory: 0 cameras are being emulated. 0 of them are fake cameras.
04-17 15:24:06.261 1435-1435/? E/CameraService: setUpVendorTags: Vendor tag operations not fully defined. Ignoring definitions.
04-17 15:24:06.348 1434-1434/? E/RadioService: couldn't load radio module radio.primary (No such file or directory)
04-17 15:24:06.348 1434-1434/? E/SoundTriggerHwService: couldn't load sound trigger module sound_trigger.primary (No such file or directory)
04-17 15:24:09.611 1686-1686/? E/PowerManagerService-JNI: Couldn't load power module (No such file or directory)
04-17 15:24:09.629 1313-1323/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
04-17 15:24:09.796 1686-1686/? E/art: DexFile_getDexOptNeeded file '/system/framework/org.apache.http.legacy.jar' does not exist
04-17 15:24:16.377 1686-1686/? E/PackageManager: There should probably be exactly one verifier; found []
04-17 15:24:16.446 1686-1705/? E/BatteryStatsService: power: gPowerModule not loaded
04-17 15:24:16.477 1686-1700/? E/KernelCpuSpeedReader: Failed to read cpu-freq: /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state (No such file or directory)
04-17 15:24:16.478 1686-1700/? E/KernelUidCpuTimeReader: Failed to read uid_cputime: /proc/uid_cputime/show_uid_stat (No such file or directory)
04-17 15:24:16.695 1686-1686/? E/ActivityThread: Failed to find provider info for settings
04-17 15:24:16.714 1686-1686/? E/System: ******************************************
04-17 15:24:16.736 1686-1686/? E/System: ************ Failure starting core service
java.lang.NullPointerException: Attempt to invoke interface method 'android.os.Bundle android.content.IContentProvider.call(java.lang.String, java.lang.String, java.lang.String, android.os.Bundle)' on a null object reference
at android.provider.Settings$NameValueCache.getStringForUser(Settings.java:1625)
at android.provider.Settings$Secure.getStringForUser(Settings.java:4259)
at android.provider.Settings$Secure.getIntForUser(Settings.java:4329)
at android.provider.Settings$Secure.getInt(Settings.java:4319)
at com.android.server.am.CoreSettingsObserver.populateSettings(CoreSettingsObserver.java:121)
at com.android.server.am.CoreSettingsObserver.sendCoreSettings(CoreSettingsObserver.java:77)
at com.android.server.am.CoreSettingsObserver.<init>(CoreSettingsObserver.java:62)
at com.android.server.am.ActivityManagerService.installSystemProviders(ActivityManagerService.java:11335)
at com.android.server.SystemServer.startOtherServices(SystemServer.java:583)
at com.android.server.SystemServer.run(SystemServer.java:326)
at com.android.server.SystemServer.main(SystemServer.java:211)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
04-17 15:24:16.872 1686-1686/? E/ActivityThread: Failed to find provider info for settings
04-17 15:24:16.873 1686-1686/? E/System: ******************************************
04-17 15:24:16.875 1686-1686/? E/System: ************ Failure starting system services
java.lang.RuntimeException: Failed to create service com.android.server.InputMethodManagerService$Lifecycle: service constructor threw an exception
at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:103)
at com.android.server.SystemServer.startOtherServices(SystemServer.java:667)
at com.android.server.SystemServer.run(SystemServer.java:326)
at com.android.server.SystemServer.main(SystemServer.java:211)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:92)
at com.android.server.SystemServer.startOtherServices(SystemServer.java:667)
at com.android.server.SystemServer.run(SystemServer.java:326)
at com.android.server.SystemServer.main(SystemServer.java:211)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'android.os.Bundle android.content.IContentProvider.call(java.lang.String, java.lang.String, java.lang.String, android.os.Bundle)' on a null object reference
at android.provider.Settings$NameValueCache.getStringForUser(Settings.java:1625)
at android.provider.Settings$Secure.getStringForUser(Settings.java:4259)
at com.android.internal.inputmethod.InputMethodUtils$InputMethodSettings.getString(InputMethodUtils.java:997)
at com.android.internal.inputmethod.InputMethodUtils$InputMethodSettings.getEnabledInputMethodsStr(InputMethodUtils.java:1178)
at com.android.internal.inputmethod.InputMethodUtils$InputMethodSettings.getEnabledInputMethodsAndSubtypeListLocked(InputMethodUtils.java:1100)
at com.android.internal.inputmethod.InputMethodUtils$InputMethodSettings.getEnabledInputMethodListLocked(InputMethodUtils.java:1044)
at com.android.internal.inputmethod.InputMethodUtils$InputMethodSettings.getExplicitlyOrImplicitlyEnabledInputMethodsAndSubtypeListLocked(InputMethodUtils.java:1438)
at com.android.internal.inputmethod.InputMethodSubtypeSwitchingController$InputMethodAndSubtypeList.getSortedInputMethodAndSubtypeList(InputMethodSubtypeSwitchingController.java:200)
at com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.resetCircularListLocked(InputMethodSubtypeSwitchingController.java:575)
at com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.<init>(InputMethodSubtypeSwitchingController.java:554)
at com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.createInstanceLocked(InputMethodSubtypeSwitchingController.java:559)
at com.android.server.InputMethodManagerService.<init>(InputMethodManagerService.java:910)
at com.android.server.InputMethodManagerService$Lifecycle.<init>(InputMethodManagerService.java:789)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at com.android.server.SystemServiceManager.startService(SystemServiceManager.java:92)
at com.android.server.SystemServer.startOtherServices(SystemServer.java:667)
at com.android.server.SystemServer.run(SystemServer.java:326)
at com.android.server.SystemServer.main(SystemServer.java:211)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
04-17 15:24:16.876 1686-1686/? E/AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
java.lang.RuntimeException: Failed to create service com.android.server.InputMethodManagerService$Lifecycle: service constructor threw an exception
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" ... >
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.
I am getting these errors in Android Studio (logcat) when apps are being run
06-05 22:59:03.664 23521-23521/com.policia E/Zygote﹕ Zygote: error closing descriptor
libcore.io.ErrnoException: close failed: EBADF (Bad file number)
at libcore.io.Posix.close(Native Method)
at libcore.io.BlockGuardOs.close(BlockGuardOs.java:75)
at com.android.internal.os.ZygoteInit.closeServerSocket(ZygoteInit.java:224)
at com.android.internal.os.ZygoteConnection.handleChildProc(ZygoteConnection.java:879)
at com.android.internal.os.ZygoteConnection.runOnce(ZygoteConnection.java:242)
at com.android.internal.os.ZygoteInit.runSelectLoop(ZygoteInit.java:704)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
can anybody tell me what causes these errors and how to solve them?