Can we program the app to restart on its own? [duplicate] - java

This question already has answers here:
How do I programmatically "restart" an Android app?
(31 answers)
Closed 3 years ago.
My app doesn't function as intended after fresh installation on the device. The user has to manually close the app and start it again for proper functionality. A quick fix is needed, something as simple as the app restarting on its own after first launch (this only has to happen 1 time).
05/22 19:44:57: Launching app
$ adb install-multiple -r -t C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\split-apk\debug\slices\slice_6.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\split-apk\debug\slices\slice_4.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\split-apk\debug\dep\dependencies.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\resources\instant-run\debug\resources-debug.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\split-apk\debug\slices\slice_9.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\split-apk\debug\slices\slice_8.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\split-apk\debug\slices\slice_2.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\split-apk\debug\slices\slice_3.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\split-apk\debug\slices\slice_5.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\split-apk\debug\slices\slice_1.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\split-apk\debug\slices\slice_7.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\split-apk\debug\slices\slice_0.apk C:\Users\Gregory\AndroidStudioProjects\GAaudioTransform\app\build\intermediates\instant-run-apk\debug\app-debug.apk
Split APKs installed in 5 s 337 ms
$ adb shell am start -n "tk.gandriks.gaaudiotransform/tk.gandriks.gaaudiotransform.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 11440 on device samsung-sm_g930f-ce05160561e0761105
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
E/Zygote: isWhitelistProcess - Process is Whitelisted
E/libpersona: scanKnoxPersonas
Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory
W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2], Con:u:r:zygote:s0 RAM:SEPF_SM-G930F_8.0.0_0018, [-1 -1 -1 -1 0 1]
I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=tk.gandriks.gaaudiotransform
I/zygote64: Late-enabling -Xcheck:jni
D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
D/ActivityThread: Added TimaKeyStore provider
I/zygote64: no shared libraies, dex_files: 1
I/InstantRun: starting instant run server: is main process
D/OpenGLRenderer: HWUI GL Pipeline
D/ViewRootImpl#d597feb[MainActivity]: setView = DecorView#ed74148[MainActivity] TM=true MM=false
D/ViewRootImpl#d597feb[MainActivity]: dispatchAttachedToWindow
V/Surface: sf_framedrop debug : 0x4f4c, game : false, logging : 0
D/ViewRootImpl#d597feb[MainActivity]: Relayout returned: old=[0,0][0,0] new=[0,0][1440,2560] result=0x7 surface={valid=true 484328804352} changed=true
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 2
D/libGLESv1: STS_GLApi : DTS, ODTC are not allowed for Package : tk.gandriks.gaaudiotransform
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000, [1440x2560]-format:1
D/OpenGLRenderer: eglCreateWindowSurface = 0x70c9e2df00
D/ViewRootImpl#d597feb[MainActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1440, 2560) ci=Rect(0, 96 - 0, 0) vi=Rect(0, 96 - 0, 0) or=1
D/ViewRootImpl#d597feb[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1
V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo#56c3619 nm : tk.gandriks.gaaudiotransform ic=null
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo#7e4d6de nm : tk.gandriks.gaaudiotransform ic=null
D/ViewRootImpl#c82cf8d[Toast]: setView = android.widget.LinearLayout{2fd8542 V.E...... ......I. 0,0-0,0} TM=true MM=false
V/Toast: Text: Qerm in android.widget.Toast$TN#7980953
D/ViewRootImpl#c82cf8d[Toast]: dispatchAttachedToWindow
V/Surface: sf_framedrop debug : 0x4f4c, game : false, logging : 0
D/ViewRootImpl#c82cf8d[Toast]: Relayout returned: old=[0,0][0,0] new=[373,2128][1066,2304] result=0x7 surface={valid=true 484137521152} changed=true
D/ViewRootImpl#c82cf8d[Toast]: MSG_RESIZED_REPORT: frame=Rect(373, 2128 - 1066, 2304) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
D/ViewRootImpl#c82cf8d[Toast]: dispatchDetachedFromWindow
D/InputEventReceiver: channel 'd449b05 Toast (client)' ~ Disposing input event receiver.
channel 'd449b05 Toast (client)' ~NativeInputEventReceiver.
V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo#7c57290 nm : tk.gandriks.gaaudiotransform ic=null
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/OpenGLRenderer: eglDestroySurface = 0x70c9e2df00
D/ViewRootImpl#d597feb[MainActivity]: Relayout returned: old=[0,0][1440,2560] new=[0,0][1440,2560] result=0x5 surface={valid=false 0} changed=true
D/ViewRootImpl#d597feb[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0
The error in this log is the line:
E/Zygote: isWhitelistProcess - Process is Whitelisted
E/libpersona: scanKnoxPersonas
Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory

Even though there might be some answers to this question, from my(and probably most of the users) point of view this would be a terrible experience. Fix the original problem, any workaround that you do that results in app restarting itself will probably end in user uninstalling your app. Keep your app stable and users happy!

Related

Retrieve Data from multiple documents from Firestore Database

Unable to fetch a value from the Firestore database. Trying to retrieve the value of the mobile number as and when the value of flat and block matches the entry in the database. Below is the code I am using. I have also attached the issues that are registered in LogCat file. Please check and help.
public class Test extends AppCompatActivity {
Button btn;
private FirebaseFirestore firestore;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
firestore = FirebaseFirestore.getInstance();
btn = (Button) findViewById(R.id.button3);
btn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
getmobile();
//makecall();
}
});
}
private void makecall(){
Intent intent = new Intent(Intent.ACTION_CALL_BUTTON);
intent.setData(Uri.parse("tel:9890910640"));
startActivity(intent);
}
private void getmobile() {
firestore.collection("users").get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
#Override
public void onSuccess(QuerySnapshot documentSnapshots) {
String a = "101";
String b = "F1A";
for(DocumentSnapshot document: documentSnapshots){
if(document.getString("flat")==a&&document.getString("block")==b){
String mobilefromdatabase = document.get("mobile").toString();
Toast.makeText(Test.this, "mobile" + mobilefromdatabase, Toast.LENGTH_LONG).show();
break;
}
}
}
});
}
}
Logcat Details
05-05 03:59:26.721 8805-8805/? E/libprocessgroup: failed to make and chown /acct/uid_10058: Read-only file system
05-05 03:59:26.721 8805-8805/? W/Zygote: createProcessGroup failed, kernel missing CONFIG_CGROUP_CPUACCT?
05-05 03:59:26.722 8805-8805/? I/art: Not late-enabling -Xcheck:jni (already on)
05-05 03:59:26.770 8805-8805/com.example.myrwaapp I/MultiDex: VM with version 2.1.0 has multidex support
05-05 03:59:26.770 8805-8805/com.example.myrwaapp I/MultiDex: Installing application
05-05 03:59:26.770 8805-8805/com.example.myrwaapp I/MultiDex: VM has multidex support, MultiDex support library is disabled.
05-05 03:59:26.842 8805-8805/com.example.myrwaapp V/FA: Registered activity lifecycle callback
05-05 03:59:26.857 8805-8831/com.example.myrwaapp W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
05-05 03:59:26.861 8805-8805/com.example.myrwaapp I/FirebaseInitProvider: FirebaseApp initialization successful
05-05 03:59:26.907 8805-8834/com.example.myrwaapp W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
05-05 03:59:26.925 8805-8834/com.example.myrwaapp I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
05-05 03:59:26.986 8805-8805/com.example.myrwaapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
05-05 03:59:27.010 8805-8805/com.example.myrwaapp V/FA: onActivityCreated
05-05 03:59:27.047 8805-8805/com.example.myrwaapp I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>
05-05 03:59:27.047 8805-8805/com.example.myrwaapp I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>
05-05 03:59:27.048 8805-8830/com.example.myrwaapp V/FA: App measurement collection enabled
05-05 03:59:27.049 8805-8830/com.example.myrwaapp V/FA: App measurement enabled for app package, google app id: com.example.myrwaapp, 1:649640616763:android:9025242f82dd4767798d1e
05-05 03:59:27.052 8805-8830/com.example.myrwaapp I/FA: App measurement initialized, version: 21028
05-05 03:59:27.052 8805-8830/com.example.myrwaapp I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
05-05 03:59:27.052 8805-8830/com.example.myrwaapp I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.example.myrwaapp
05-05 03:59:27.052 8805-8830/com.example.myrwaapp D/FA: Debug-level message logging enabled
05-05 03:59:27.077 8805-8830/com.example.myrwaapp V/FA: Connecting to remote service
05-05 03:59:27.089 8805-8830/com.example.myrwaapp V/FA: Connection attempt already in progress
05-05 03:59:27.143 8805-8830/com.example.myrwaapp V/FA: Activity resumed, time: 8622127
05-05 03:59:27.145 8805-8830/com.example.myrwaapp I/FA: Tag Manager is not found and thus will not be used
05-05 03:59:27.151 8805-8838/com.example.myrwaapp D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
05-05 03:59:27.154 8805-8805/com.example.myrwaapp D/Atlas: Validating map...
05-05 03:59:27.159 8805-8830/com.example.myrwaapp V/FA: Connection attempt already in progress
05-05 03:59:27.159 8805-8830/com.example.myrwaapp V/FA: Connection attempt already in progress
05-05 03:59:27.188 8805-8838/com.example.myrwaapp I/OpenGLRenderer: Initialized EGL, version 1.4
05-05 03:59:27.188 8805-8838/com.example.myrwaapp W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
05-05 03:59:27.215 8805-8838/com.example.myrwaapp D/EGL_emulation: eglCreateContext: 0xa2003100: maj 2 min 0 rcv 2
05-05 03:59:27.240 8805-8838/com.example.myrwaapp D/EGL_emulation: eglMakeCurrent: 0xa2003100: ver 2 0 (tinfo 0xb4233e90)
05-05 03:59:27.243 8805-8838/com.example.myrwaapp D/OpenGLRenderer: Enabling debug mode 0
05-05 03:59:27.294 8805-8838/com.example.myrwaapp D/EGL_emulation: eglMakeCurrent: 0xa2003100: ver 2 0 (tinfo 0xb4233e90)
05-05 03:59:27.738 8805-8830/com.example.myrwaapp D/FA: Connected to remote service
05-05 03:59:27.738 8805-8830/com.example.myrwaapp V/FA: Processing queued up service tasks: 4
05-05 03:59:32.795 8805-8830/com.example.myrwaapp V/FA: Inactivity, disconnecting from the service
05-05 03:59:38.884 8805-8830/com.example.myrwaapp V/FA: Recording user engagement, ms: 11740
05-05 03:59:38.886 8805-8830/com.example.myrwaapp V/FA: Connecting to remote service
05-05 03:59:38.892 8805-8830/com.example.myrwaapp V/FA: Activity paused, time: 8633867
05-05 03:59:38.894 8805-8805/com.example.myrwaapp V/FA: onActivityCreated
05-05 03:59:38.913 8805-8830/com.example.myrwaapp V/FA: Connection attempt already in progress
05-05 03:59:38.913 8805-8830/com.example.myrwaapp V/FA: Activity resumed, time: 8633895
05-05 03:59:38.926 8805-8830/com.example.myrwaapp V/FA: Connection attempt already in progress
05-05 03:59:38.926 8805-8830/com.example.myrwaapp V/FA: Connection attempt already in progress
05-05 03:59:38.993 8805-8838/com.example.myrwaapp D/EGL_emulation: eglMakeCurrent: 0xa2003100: ver 2 0 (tinfo 0xb4233e90)
05-05 03:59:39.034 8805-8838/com.example.myrwaapp D/EGL_emulation: eglMakeCurrent: 0xa2003100: ver 2 0 (tinfo 0xb4233e90)
05-05 03:59:39.051 8805-8838/com.example.myrwaapp D/EGL_emulation: eglMakeCurrent: 0xa2003100: ver 2 0 (tinfo 0xb4233e90)
05-05 03:59:39.177 8805-8838/com.example.myrwaapp D/EGL_emulation: eglMakeCurrent: 0xa2003100: ver 2 0 (tinfo 0xb4233e90)
05-05 03:59:39.222 8805-8830/com.example.myrwaapp D/FA: Connected to remote service
05-05 03:59:39.222 8805-8830/com.example.myrwaapp V/FA: Processing queued up service tasks: 4
05-05 03:59:39.224 8805-8838/com.example.myrwaapp D/EGL_emulation: eglMakeCurrent: 0xa2003100: ver 2 0 (tinfo 0xb4233e90)
05-05 03:59:39.335 8805-8838/com.example.myrwaapp D/EGL_emulation: eglMakeCurrent: 0xa2003100: ver 2 0 (tinfo 0xb4233e90)
05-05 03:59:44.247 8805-8830/com.example.myrwaapp V/FA: Inactivity, disconnecting from the service
05-05 03:59:48.704 8805-8838/com.example.myrwaapp D/EGL_emulation: eglMakeCurrent: 0xa2003100: ver 2 0 (tinfo 0xb4233e90)
05-05 03:59:48.871 8805-8849/com.example.myrwaapp W/DynamiteModule: Local module descriptor class for providerinstaller not found.
05-05 03:59:48.877 8805-8849/com.example.myrwaapp I/DynamiteModule: Considering local module providerinstaller:0 and remote module providerinstaller:0
05-05 03:59:48.877 8805-8849/com.example.myrwaapp W/ProviderInstaller: Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
05-05 03:59:48.881 8805-8849/com.example.myrwaapp W/ResourcesManager: Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
05-05 03:59:48.881 8805-8849/com.example.myrwaapp W/ResourcesManager: Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
05-05 03:59:48.942 8805-8849/com.example.myrwaapp W/linker: libconscrypt_gmscore_jni.so: unused DT entry: type 0x6ffffffe arg 0x13dc
05-05 03:59:48.942 8805-8849/com.example.myrwaapp W/linker: libconscrypt_gmscore_jni.so: unused DT entry: type 0x6fffffff arg 0x2
05-05 03:59:48.948 8805-8849/com.example.myrwaapp V/NativeCrypto: Registering com/google/android/gms/org/conscrypt/NativeCrypto's 284 native methods...
05-05 03:59:48.963 8805-8820/com.example.myrwaapp I/art: Background sticky concurrent mark sweep GC freed 976(49KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 8MB/8MB, paused 5.861ms total 31.265ms
05-05 03:59:48.992 8805-8849/com.example.myrwaapp I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java7ExtendedSSLSession>
05-05 03:59:48.992 8805-8849/com.example.myrwaapp I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java7ExtendedSSLSession>
05-05 03:59:48.992 8805-8849/com.example.myrwaapp I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java8ExtendedSSLSession>
05-05 03:59:48.992 8805-8849/com.example.myrwaapp I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java8ExtendedSSLSession>
05-05 03:59:49.002 8805-8849/com.example.myrwaapp I/ProviderInstaller: Installed default security provider GmsCore_OpenSSL
First of all, String comparison in Java, should not be performed using == operator, as it will always compare the address of the objects from the memory and not the actual values. String comparison should be done using equals() method.
Moreover, if you need an AND operation, you should not get all documents that exist within the users collection and make the comparison on the client. For that, you should use a query that looks exactly like this:
String a = "101";
String b = "F1A";
FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
CollectionReference usersRef = rootRef.collection("users");
Query query = usersRef.whereEqualTo("flat", a).whereEqualTo("block", b);
query.get().addOnSuccessListener(/* ... */);
In this way, you are going to get only the documents where the flat property holds the value of 101 AND the value of block holds F1A. As I think that only one apartment has that constraint, you'll be billed with only one read operation.

Camera surface preview gives multiple errors on multiple devices

The Problem:
In using the camera on the device, I'm getting a number of errors. I have looked over many answers here on StackOverflow and I have tried many solutions to no avail. I'm not sure what the problem is. I have tried this on two different devices and I'm getting the same errors. This is failing on multiple devices... Samsung Galaxy S7 and a Vankyo Z4 Tablet. The logs are from the tablet.
2020-01-27 06:51:43.571 4182-4182/ W/e.myapplicatio: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
2020-01-27 06:51:43.649 4182-4182/ D/OpenGLRenderer: Skia GL Pipeline
2020-01-27 06:51:44.474 4182-4182/ E/Camera: Error 2
2020-01-27 06:51:44.600 4182-4262/ I/mali_so: [File] : hardware/rockchip/mali_so_src_of_midgard/driver/product/base/src/mali_base_kbase.c; [Line] : 1095; [Func] : base_context_deal_with_version_affairs_rk_ext;
arm_release_ver of this mali_so is 'r12p0-01rel0', rk_so_ver is '9#0 '.
2020-01-27 06:51:44.600 4182-4262/ I/mali_so: [File] : hardware/rockchip/mali_so_src_of_midgard/driver/product/base/src/mali_base_kbase.c; [Line] : 1101; [Func] : base_context_deal_with_version_affairs_rk_ext;
mali_ver_property has been set to 'r12p0-01rel0-x-9#0', to return.
2020-01-27 06:51:44.601 4182-4262/ I/mali_so: [File] : hardware/rockchip/mali_so_src_of_midgard/driver/product/cmem/src/mali_cmem_hoard.c; [Line] : 559; [Func] : should_current_process_not_to_use_hoard;
WOULD use hoard.
2020-01-27 06:51:44.617 4182-4262/ I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2020-01-27 06:51:44.618 4182-4262/ I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2020-01-27 06:51:44.618 4182-4262/ I/OpenGLRenderer: Initialized EGL, version 1.4
2020-01-27 06:51:44.618 4182-4262/ D/OpenGLRenderer: Swap behavior 2
2020-01-27 06:51:44.648 4182-4262/ D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
2020-01-27 06:51:44.670 4182-4182/ D/Camera: setPreviewTexture failed
2020-01-27 06:51:44.674 4182-4182/ D/Camera: Rotate 270
2020-01-27 06:51:44.675 4182-4182/ D/Camera: setDisplayOrientation Failed: set display orientation failed
2020-01-27 06:51:44.677 4182-4182/ D/Camera: setPreviewTexture failed
2020-01-27 06:51:45.630 4182-4182/ D/Camera: Rotate 270
2020-01-27 06:51:45.818 4182-4182/ I/Choreographer: Skipped 76 frames! The application may be doing too much work on its main thread.
2020-01-27 06:51:46.014 4182-4262/ D/GRALLOC-ROCKCHIP: RK_GRAPHICS_VER=commit-id:69cd12f
2020-01-27 06:51:46.464 4182-4262/ I/OpenGLRenderer: Davey! duration=1946ms; Flags=1, IntendedVsync=15482245744667, Vsync=15483533880219, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=15483548307810, AnimationStart=15483548629227, PerformTraversalsStart=15483550124019, DrawStart=15483591003440, SyncQueued=15483639373153, SyncStart=15483640225986, IssueDrawCommandsStart=15483711543452, SwapBuffers=15484188006958, FrameCompleted=15484193184333, DequeueBufferDuration=14675000, QueueBufferDuration=3065000,
2020-01-27 06:51:46.491 4182-4182/ I/Choreographer: Skipped 39 frames! The application may be doing too much work on its main thread.
2020-01-27 06:51:46.539 4182-4262/ I/OpenGLRenderer: Davey! duration=709ms; Flags=0, IntendedVsync=15483558409277, Vsync=15484219426205, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=15484220349586, AnimationStart=15484220561045, PerformTraversalsStart=15484222148003, DrawStart=15484224182962, SyncQueued=15484224448962, SyncStart=15484224914753, IssueDrawCommandsStart=15484225396878, SwapBuffers=15484260477090, FrameCompleted=15484268449216, DequeueBufferDuration=11816000, QueueBufferDuration=3806000,
2020-01-27 06:53:10.381 4182-4262/ W/libEGL: EGLNativeWindowType 0xee0ea008 disconnect failed
2020-01-27 06:53:11.199 4182-4182/ I/Choreographer: Skipped 49 frames! The application may be doing too much work on its main thread.
2020-01-27 06:53:11.283 4182-4262/ D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
2020-01-27 06:53:11.363 4182-4182/ D/Camera: setPreviewTexture failed
2020-01-27 06:53:11.368 4182-4182/ D/Camera: Rotate 0
2020-01-27 06:53:11.369 4182-4182/ D/Camera: setDisplayOrientation Failed: set display orientation failed
2020-01-27 06:53:11.371 4182-4182/ D/Camera: setPreviewTexture failed
2020-01-27 06:53:12.680 4182-4182/ D/Camera: Rotate 0
2020-01-27 06:53:12.691 4182-4182/ E/Camera: Error 2
2020-01-27 06:53:12.729 4182-4182/ I/Choreographer: Skipped 87 frames! The application may be doing too much work on its main thread.
2020-01-27 06:53:12.851 4182-4262/ I/OpenGLRenderer: Davey! duration=1608ms; Flags=1, IntendedVsync=15568971643421, Vsync=15570446219645, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=15570459148001, AnimationStart=15570459500626, PerformTraversalsStart=15570461186751, DrawStart=15570496844172, SyncQueued=15570546182510, SyncStart=15570546388427, IssueDrawCommandsStart=15570562532470, SwapBuffers=15570576764930, FrameCompleted=15570579908513, DequeueBufferDuration=7076000, QueueBufferDuration=956000,
2020-01-27 06:53:35.328 4182-4262/ W/libEGL: EGLNativeWindowType 0xd48dd008 disconnect failed
2020-01-27 06:53:36.017 4182-4182/ I/Choreographer: Skipped 39 frames! The application may be doing too much work on its main thread.
2020-01-27 06:53:36.096 4182-4262/ D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
2020-01-27 06:53:36.175 4182-4182/ D/Camera: setPreviewTexture failed
2020-01-27 06:53:36.178 4182-4182/ D/Camera: Rotate 270
2020-01-27 06:53:36.179 4182-4182/ D/Camera: setDisplayOrientation Failed: set display orientation failed
2020-01-27 06:53:36.181 4182-4182/ D/Camera: setPreviewTexture failed
2020-01-27 06:53:36.978 4182-4182/ D/Camera: Rotate 270
2020-01-27 06:53:36.990 4182-4182/ E/Camera: Error 2
2020-01-27 06:53:37.040 4182-4182/ I/Choreographer: Skipped 58 frames! The application may be doing too much work on its main thread.
2020-01-27 06:53:37.160 4182-4262/ I/OpenGLRenderer: Davey! duration=1105ms; Flags=1, IntendedVsync=15593784036511, Vsync=15594767087327, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=15594770152361, AnimationStart=15594770423902, PerformTraversalsStart=15594772051694, DrawStart=15594807059573, SyncQueued=15594846584202, SyncStart=15594846778160, IssueDrawCommandsStart=15594869251079, SwapBuffers=15594887089997, FrameCompleted=15594889647331, DequeueBufferDuration=7349000, QueueBufferDuration=1031000,
2020-01-27 06:53:51.816 4182-4262/ W/libEGL: EGLNativeWindowType 0xd48dd008 disconnect failed
2020-01-27 06:53:52.497 4182-4182/ I/Choreographer: Skipped 39 frames! The application may be doing too much work on its main thread.
2020-01-27 06:53:52.568 4182-4262/ D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
2020-01-27 06:53:52.655 4182-4182/ D/Camera: setPreviewTexture failed
2020-01-27 06:53:52.659 4182-4182/ D/Camera: Rotate 0
2020-01-27 06:53:52.660 4182-4182/ D/Camera: setDisplayOrientation Failed: set display orientation failed
2020-01-27 06:53:52.661 4182-4182/ D/Camera: setPreviewTexture failed
2020-01-27 06:53:53.166 4182-4182/ D/Camera: Rotate 0
2020-01-27 06:53:53.174 4182-4182/ E/Camera: Error 2
2020-01-27 06:53:53.209 4182-4182/ I/Choreographer: Skipped 38 frames! The application may be doing too much work on its main thread.
2020-01-27 06:53:53.333 4182-4262/ I/OpenGLRenderer: Davey! duration=781ms; Flags=1, IntendedVsync=15610280644733, Vsync=15610924712509, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=15610938505568, AnimationStart=15610938769527, PerformTraversalsStart=15610940187027, DrawStart=15610980021989, SyncQueued=15611021218452, SyncStart=15611021401618, IssueDrawCommandsStart=15611042124829, SwapBuffers=15611058239997, FrameCompleted=15611062475581, DequeueBufferDuration=8643000, QueueBufferDuration=1439000,
2020-01-27 06:54:33.415 4182-4262/ W/libEGL: EGLNativeWindowType 0xd48dd008 disconnect failed
2020-01-27 06:54:34.104 4182-4182/ I/Choreographer: Skipped 41 frames! The application may be doing too much work on its main thread.
2020-01-27 06:54:34.172 4182-4262/ D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
2020-01-27 06:54:34.250 4182-4182/ D/Camera: setPreviewTexture failed
2020-01-27 06:54:34.252 4182-4182/ D/Camera: Rotate 270
2020-01-27 06:54:34.254 4182-4182/ D/Camera: setDisplayOrientation Failed: set display orientation failed
2020-01-27 06:54:34.256 4182-4182/ D/Camera: setPreviewTexture failed
2020-01-27 06:54:34.761 4182-4182/ D/Camera: Rotate 270
2020-01-27 06:54:34.774 4182-4182/ E/Camera: Error 2
2020-01-27 06:54:34.805 4182-4182/ I/Choreographer: Skipped 38 frames! The application may be doing too much work on its main thread.
2020-01-27 06:54:34.942 4182-4262/ I/OpenGLRenderer: Davey! duration=794ms; Flags=1, IntendedVsync=15651876176648, Vsync=15652520244424, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=15652534305206, AnimationStart=15652534506748, PerformTraversalsStart=15652537321040, DrawStart=15652583784419, SyncQueued=15652629034174, SyncStart=15652629455049, IssueDrawCommandsStart=15652650115843, SwapBuffers=15652667089970, FrameCompleted=15652670663762, DequeueBufferDuration=9324000, QueueBufferDuration=1607000,
2020-01-27 07:03:10.639 4182-4262/ W/libEGL: EGLNativeWindowType 0xd48dd008 disconnect failed
As can be seen from the log, when the orientation changes, surfaceChanged callback gets called twice. The first time, I get the setDisplayOrientation failed. I'm not sure why I'm getting setPreviewTexture failed because I'm not even using TextureView. I also don't know why I'm getting Error 2 for the camera either. I have tried several solutions that I found here and elsewhere to no avail. Here's the code in question:
#Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Display display;
int rotation;
int degrees = 0;
int result;
// If the holder is null, then just return.
if (mHolder.getSurface() == null) {
return;
}
// Stop the preview.
try {
if (isPreviewRunning) {
mCamera.stopPreview();
isPreviewRunning = false;
}
} catch (Exception e) {
Log.d("Camera", "Stop Preview Failed: " + e.getMessage());
}
// Check the device orientation.
display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
rotation = display.getRotation();
switch (rotation) {
case Surface.ROTATION_0:
Log.d("Camera", "Rotate 0");
degrees = 0;
break;
case Surface.ROTATION_90:
Log.d("Camera", "Rotate 90");
degrees = 90;
break;
case Surface.ROTATION_180:
Log.d("Camera", "Rotate 180");
degrees = 180;
break;
case Surface.ROTATION_270:
Log.d("Camera", "Rotate 270");
degrees = 270;
break;
}
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
result = (cameraInfo.orientation + degrees) % 360;
result = (360 - result) % 360; // compensate the mirror
} else { // back-facing
result = (cameraInfo.orientation - degrees + 360) % 360;
}
// Not sure why this fails. No reason given.
try {
mCamera.setDisplayOrientation(result);
} catch (Exception e) {
Log.d("Camera", "setDisplayOrientation Failed: " + e.getMessage());
}
// Restart the preview with the new changes.
try {
mCamera.setPreviewDisplay(holder);
mCamera.startPreview();
isPreviewRunning = true;
} catch (IOException e) {
Log.d("Camera", e.getMessage());
}
}
Despite the errors, it does work. So should I just ignore the errors or continue to try to fix them? I am writing for API level 19. I know that Camera was depreciated in API 21, but older devices are still out there and I want this code to run on those as well. As for the research, there seems to be two main solutions. I have tried both and they do not work. The one with the getParameters is telling me that getParameters failed that it returned null, which should not happen, but it does.
Research:
As for the research that I have done trying to fix this problem...
https://www.codeproject.com/Questions/626862/Android-Camera-setDisplayOrientation-Failed
Textureview/Surface view for Camera preview - Android
Problem with camera when orientation changes
Android Camera setDisplayOrientation does not work
android camera setDisplayOrientation(90) fails in different devices
Set display orientation failed

Java - Discovering Raspberry Pi hostname - works on windows but not on Android

Hello :) I use this script to discover hostnames on my network. It works perfectly when I run it on Windows, allowing me to see all of my active devices, including my Raspberry Pi 3 b+ Stretch (which is the desired target).
import java.io.IOException;
import java.net.InetAddress;
public class Main {
public static void main(String[] args)
{
try {
InetAddress inetAddress = InetAddress.getLocalHost();
System.out.println("IP Address:- " + inetAddress.getHostAddress());
System.out.println("Host Name:- " + inetAddress.getHostName());
InetAddress ipd = InetAddress.getByName("10.0.0.1");
byte[] ip = ipd.getAddress();
for (int i = 1; i < 255; i++)
{
ip[3] = (byte)i;
InetAddress address = InetAddress.getByAddress(ip);
System.out.println(address);
System.out.println(address.getHostName());
if (address.getHostName().toLowerCase().contains("raspberry")) {
System.out.println("PI FOUND!!!");
System.out.println(address.getHostName());
}
}
}
catch (IOException e) {
e.printStackTrace();
} }
}
However, when I run the script on either of my two android phones (Samsung J7 and Nokia 6.1) I cannot see any of the devices on my network, including the Pi.
If I run the script directly from the Pi it identifies as the loopback localhost ip of 127.0.0.1 and then cannot find itself as it scans through the IPs of my network. I believe this has something to do with DNS settings but then why does it work from my windows PC when its using the same DNS servers?
One note: It works for my colleague. He has exactly the same setup (same Raspberry model, Raspbian image and phones).
Is there something wrong in the code? Is there something on Android that prevents it from working properly? My guess is that it could be related to my router settings but then why does it work when I run it on Windows?
Thank you in advance for any help!
UPDATE: I was able to run the cordova app through Android Studio. I only set it to read the first 5 IP addresses (i.e. 10.0.0.1 - 10.0.0.5). The Pi was on 10.0.0.5. Here is the catlog:
2019-02-07 19:03:46.035 18008-18008/? E/Zygote: isWhitelistProcess -
Process is Whitelisted 2019-02-07 19:03:46.036 18008-18008/?
E/libpersona: scanKnoxPersonas 2019-02-07 19:03:46.036 18008-18008/?
E/libpersona: Couldn't open the File -
/data/system/users/0/personalist.xml - No such file or directory
2019-02-07 19:03:46.039 18008-18008/? W/SELinux: SELinux
selinux_android_compute_policy_index : Policy Index[2],
Con:u:r:zygote:s0 RAM:SEPF_SAMSUNG-SM-J727A_8.1.0_0004, [-1 -1 -1 -1 0
1] 2019-02-07 19:03:46.040 18008-18008/? I/SELinux: SELinux:
seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768,
pkgname=io.cordova.hellocordova 2019-02-07 19:03:46.044 18008-18008/?
I/zygote: Late-enabling -Xcheck:jni 2019-02-07 19:03:46.107
18008-18008/? D/TimaKeyStoreProvider: TimaKeyStore is not enabled:
cannot add TimaSignature Service and generateKeyPair Service
2019-02-07 19:03:46.108 18008-18008/? D/ActivityThread: Added
TimaKeyStore provider 2019-02-07 19:03:46.211
18008-18008/io.cordova.hellocordova I/CordovaLog: Changing log level
to DEBUG(3) 2019-02-07 19:03:46.211
18008-18008/io.cordova.hellocordova I/CordovaActivity: Apache Cordova
native platform version 7.1.4 is starting 2019-02-07 19:03:46.211
18008-18008/io.cordova.hellocordova D/CordovaActivity:
CordovaActivity.onCreate() 2019-02-07 19:03:46.232
18008-18008/io.cordova.hellocordova I/WebViewFactory: Loading
com.android.chrome version 71.0.3578.99 (code 357809902) 2019-02-07
19:03:46.295 18008-18008/io.cordova.hellocordova I/cr_LibraryLoader:
Time to load native libraries: 7 ms (timestamps 2174-2181) 2019-02-07
19:03:46.341 18008-18008/io.cordova.hellocordova I/chromium:
[INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level =
0, default verbosity = 0 2019-02-07 19:03:46.342
18008-18008/io.cordova.hellocordova I/cr_LibraryLoader: Expected
native library version number "71.0.3578.99", actual native library
version number "71.0.3578.99" 2019-02-07 19:03:46.350
18008-18033/io.cordova.hellocordova W/cr_ChildProcLH: Create a new
ChildConnectionAllocator with package name = com.android.chrome,
sandboxed = true 2019-02-07 19:03:46.360
18008-18008/io.cordova.hellocordova I/cr_BrowserStartup: Initializing
chromium process, singleProcess=false 2019-02-07 19:03:46.366
18008-18008/io.cordova.hellocordova W/ResourceType: Failure getting
entry for 0x7f120515 (t=17 e=1301) (error -2147483647) 2019-02-07
19:03:46.591 18008-18008/io.cordova.hellocordova
D/SystemWebViewEngine: CordovaWebView is running on device made by:
samsung 2019-02-07 19:03:46.608 18008-18008/io.cordova.hellocordova
D/PluginManager: init() 2019-02-07 19:03:46.617
18008-18008/io.cordova.hellocordova D/CordovaWebViewImpl: >>>
loadUrl(file:///android_asset/www/index.html) 2019-02-07 19:03:46.629
18008-18060/io.cordova.hellocordova W/cr_media: Requires BLUETOOTH
permission 2019-02-07 19:03:46.631 18008-18008/io.cordova.hellocordova
D/CordovaActivity: Started the activity. 2019-02-07 19:03:46.635
18008-18078/io.cordova.hellocordova I/zygote:
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay
retrieved: 0 2019-02-07 19:03:46.639
18008-18008/io.cordova.hellocordova D/CordovaActivity: Resumed the
activity. 2019-02-07 19:03:46.655 18008-18092/io.cordova.hellocordova
D/OpenGLRenderer: HWUI GL Pipeline 2019-02-07 19:03:46.663
18008-18008/io.cordova.hellocordova D/InputTransport: Input channel
constructed: fd=127 2019-02-07 19:03:46.664
18008-18008/io.cordova.hellocordova
D/ViewRootImpl#a469c78[MainActivity]: setView =
DecorView#8d5f51[MainActivity] TM=true MM=false 2019-02-07
19:03:46.681 18008-18008/io.cordova.hellocordova D/CordovaWebViewImpl:
onPageDidNavigate(file:///android_asset/www/index.html) 2019-02-07
19:03:46.687 18008-18008/io.cordova.hellocordova V/InputMethodManager:
Not IME target window, ignoring 2019-02-07 19:03:46.698
18008-18078/io.cordova.hellocordova W/AudioCapabilities: Unsupported
mime audio/x-ima 2019-02-07 19:03:46.728
18008-18078/io.cordova.hellocordova W/AudioCapabilities: Unsupported
mime audio/mpeg-L1 2019-02-07 19:03:46.729
18008-18078/io.cordova.hellocordova W/AudioCapabilities: Unsupported
mime audio/mpeg-L2 2019-02-07 19:03:46.743
18008-18078/io.cordova.hellocordova W/AudioCapabilities: Unsupported
mime audio/x-ms-wma 2019-02-07 19:03:46.746
18008-18008/io.cordova.hellocordova
D/ViewRootImpl#a469c78[MainActivity]: dispatchAttachedToWindow
2019-02-07 19:03:46.772 18008-18008/io.cordova.hellocordova V/Surface:
sf_framedrop debug : 0x4f4c, game : true, logging : 0 2019-02-07
19:03:46.774 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#a469c78[MainActivity]: Relayout returned:
old=[0,0][0,0] new=[0,0][720,1280] result=0x7 surface={valid=true
3339589632} changed=true 2019-02-07 19:03:46.776
18008-18092/io.cordova.hellocordova I/OpenGLRenderer: Initialized EGL,
version 1.4 2019-02-07 19:03:46.777
18008-18092/io.cordova.hellocordova D/OpenGLRenderer: Swap behavior 2
2019-02-07 19:03:46.781 18008-18092/io.cordova.hellocordova
D/libGLESv1: STS_GLApi : DTS, ODTC are not allowed for Package :
io.cordova.hellocordova 2019-02-07 19:03:46.783
18008-18092/io.cordova.hellocordova D/mali_winsys: EGLint
new_window_surface(egl_winsys_display *, void *, EGLSurface,
EGLConfig, egl_winsys_surface **, egl_color_buffer_format *,
EGLBoolean) returns 0x3000, [720x1280]-format:1 2019-02-07
19:03:46.783 18008-18092/io.cordova.hellocordova D/OpenGLRenderer:
eglCreateWindowSurface = 0xdd00c390, 0xc70e1808 2019-02-07
19:03:46.809 18008-18092/io.cordova.hellocordova D/vndksupport:
Loading /vendor/lib/hw/android.hardware.graphics.mapper#2.0-impl.so
from current namespace instead of sphal namespace. 2019-02-07
19:03:46.827 18008-18078/io.cordova.hellocordova W/VideoCapabilities:
Unsupported mime video/mp43 2019-02-07 19:03:46.841
18008-18078/io.cordova.hellocordova W/VideoCapabilities: Unrecognized
profile/level 1/32 for video/mp4v-es 2019-02-07 19:03:46.842
18008-18078/io.cordova.hellocordova W/VideoCapabilities: Unrecognized
profile/level 32768/2 for video/mp4v-es 2019-02-07 19:03:46.842
18008-18078/io.cordova.hellocordova W/VideoCapabilities: Unrecognized
profile/level 32768/64 for video/mp4v-es 2019-02-07 19:03:46.847
18008-18078/io.cordova.hellocordova W/VideoCapabilities: Unsupported
mime video/wvc1 2019-02-07 19:03:46.850
18008-18078/io.cordova.hellocordova W/VideoCapabilities: Unsupported
mime video/wvc1 2019-02-07 19:03:46.874
18008-18092/io.cordova.hellocordova D/libGLESv2: STS_GLApi : DTS, ODTC
are not allowed for Package : io.cordova.hellocordova 2019-02-07
19:03:46.877 18008-18078/io.cordova.hellocordova W/VideoCapabilities:
Unsupported mime video/x-ms-wmv7 2019-02-07 19:03:46.882
18008-18078/io.cordova.hellocordova W/VideoCapabilities: Unsupported
mime video/x-ms-wmv8 2019-02-07 19:03:46.887
18008-18008/io.cordova.hellocordova
D/ViewRootImpl#a469c78[MainActivity]: MSG_RESIZED_REPORT:
frame=Rect(0, 0 - 720, 1280) ci=Rect(0, 48 - 0, 0) vi=Rect(0, 48 - 0,
0) or=1 2019-02-07 19:03:46.887 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#a469c78[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1
2019-02-07 19:03:46.895 18008-18008/io.cordova.hellocordova
V/InputMethodManager: Starting input:
tba=android.view.inputmethod.EditorInfo#b609fcb nm :
io.cordova.hellocordova ic=null 2019-02-07 19:03:46.896
18008-18008/io.cordova.hellocordova D/InputMethodManager:
startInputInner - Id : 0 2019-02-07 19:03:46.896
18008-18008/io.cordova.hellocordova I/InputMethodManager:
startInputInner - mService.startInputOrWindowGainedFocus 2019-02-07
19:03:46.911 18008-18022/io.cordova.hellocordova D/InputTransport:
Input channel constructed: fd=107 2019-02-07 19:03:46.922
18008-18008/io.cordova.hellocordova V/InputMethodManager: Starting
input: tba=android.view.inputmethod.EditorInfo#ad613a8 nm :
io.cordova.hellocordova ic=null 2019-02-07 19:03:46.923
18008-18008/io.cordova.hellocordova D/InputMethodManager:
startInputInner - Id : 0 2019-02-07 19:03:46.924
18008-18078/io.cordova.hellocordova I/VideoCapabilities: Unsupported
profile 4 for video/mp4v-es 2019-02-07 19:03:47.211
18008-18008/io.cordova.hellocordova D/JsMessageQueue: Set native->JS
mode to EvalBridgeMode 2019-02-07 19:03:48.086
18008-18008/io.cordova.hellocordova D/SystemWebChromeClient:
file:///android_asset/www/main.12e606c81a2773901da4.js: Line 1 : null
2019-02-07 19:03:48.086 18008-18008/io.cordova.hellocordova
I/chromium: [INFO:CONSOLE(1)] "null", source:
file:///android_asset/www/main.12e606c81a2773901da4.js (1) 2019-02-07
19:03:48.473 18008-18121/io.cordova.hellocordova W/PluginManager:
THREAD WARNING: exec() call to networkinterface.getWiFiIPAddress
blocked the main thread for 20ms. Plugin should use
CordovaInterface.getThreadPool(). 2019-02-07 19:03:48.483
18008-18121/io.cordova.hellocordova W/CordovaPlugin: Attempted to send
a second callback for ID: networkinterface1017920643
Result was: "Invalid action" 2019-02-07 19:03:48.565 18008-18008/io.cordova.hellocordova D/ScrollView: initGoToTop
2019-02-07 19:03:48.583 18008-18008/io.cordova.hellocordova
D/ScrollView: initGoToTop 2019-02-07 19:03:48.606
18008-18014/io.cordova.hellocordova I/zygote: Do partial code cache
collection, code=30KB, data=29KB 2019-02-07 19:03:48.606
18008-18014/io.cordova.hellocordova I/zygote: After code cache
collection, code=30KB, data=29KB 2019-02-07 19:03:48.607
18008-18014/io.cordova.hellocordova I/zygote: Increasing code cache
capacity to 128KB 2019-02-07 19:03:48.625
18008-18008/io.cordova.hellocordova D/InputTransport: Input channel
constructed: fd=144 2019-02-07 19:03:48.626
18008-18008/io.cordova.hellocordova
D/ViewRootImpl#dd9a47f[MainActivity]: setView =
DecorView#f03ec4c[MainActivity] TM=true MM=false 2019-02-07
19:03:48.646 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#dd9a47f[MainActivity]: dispatchAttachedToWindow
2019-02-07 19:03:48.690 18008-18008/io.cordova.hellocordova V/Surface:
sf_framedrop debug : 0x4f4c, game : true, logging : 0 2019-02-07
19:03:48.692 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#dd9a47f[MainActivity]: Relayout returned:
old=[0,0][0,0] new=[18,475][702,853] result=0x7 surface={valid=true
3280465920} changed=true 2019-02-07 19:03:48.695
18008-18092/io.cordova.hellocordova D/mali_winsys: EGLint
new_window_surface(egl_winsys_display *, void *, EGLSurface,
EGLConfig, egl_winsys_surface **, egl_color_buffer_format *,
EGLBoolean) returns 0x3000, [812x506]-format:1 2019-02-07
19:03:48.695 18008-18092/io.cordova.hellocordova D/OpenGLRenderer:
eglCreateWindowSurface = 0xc4305530, 0xc387f008 2019-02-07
19:03:48.716 18008-18008/io.cordova.hellocordova D/ScrollView: onsize
change changed 2019-02-07 19:03:48.717
18008-18008/io.cordova.hellocordova D/ScrollView: onsize change
changed 2019-02-07 19:03:48.721 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#dd9a47f[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1
2019-02-07 19:03:48.756 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#dd9a47f[MainActivity]: MSG_RESIZED_REPORT:
frame=Rect(18, 475 - 702, 853) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0,
0) or=1 2019-02-07 19:03:48.778 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#a469c78[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0
2019-02-07 19:03:49.562 18008-18014/io.cordova.hellocordova I/zygote:
Do partial code cache collection, code=42KB, data=55KB 2019-02-07
19:03:49.563 18008-18014/io.cordova.hellocordova I/zygote: After code
cache collection, code=42KB, data=55KB 2019-02-07 19:03:49.563
18008-18014/io.cordova.hellocordova I/zygote: Increasing code cache
capacity to 256KB 2019-02-07 19:03:49.565
18008-18014/io.cordova.hellocordova I/zygote: Compiler allocated 4MB
to compile void android.view.ViewRootImpl.performTraversals()
2019-02-07 19:03:49.940 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#dd9a47f[MainActivity]: ViewPostIme pointer 0 2019-02-07
19:03:50.005 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#dd9a47f[MainActivity]: ViewPostIme pointer 1 2019-02-07
19:03:50.053 18008-18121/io.cordova.hellocordova W/CordovaPlugin:
Attempted to send a second callback for ID: Hello1017920644
Result was: "/10.0.0.1" 2019-02-07 19:03:50.056 18008-18121/io.cordova.hellocordova W/CordovaPlugin: Attempted to send
a second callback for ID: Hello1017920644
Result was: "/10.0.0.2" 2019-02-07 19:03:50.058 18008-18121/io.cordova.hellocordova W/CordovaPlugin: Attempted to send
a second callback for ID: Hello1017920644
Result was: "/10.0.0.3" 2019-02-07 19:03:50.060 18008-18121/io.cordova.hellocordova W/CordovaPlugin: Attempted to send
a second callback for ID: Hello1017920644
Result was: "/10.0.0.4" 2019-02-07 19:03:50.062 18008-18121/io.cordova.hellocordova W/CordovaPlugin: Attempted to send
a second callback for ID: Hello1017920644
Result was: "/10.0.0.5" 2019-02-07 19:03:50.472 18008-18121/io.cordova.hellocordova W/CordovaPlugin: Attempted to send
a second callback for ID: Hello1017920644
Result was: "/10.0.0.254" 2019-02-07 19:03:50.476 18008-18121/io.cordova.hellocordova W/CordovaPlugin: Attempted to send
a second callback for ID: Hello1017920644
Result was: "IP Address:127.0.0.1// Host Name:localhost" 2019-02-07 19:03:50.476 18008-18121/io.cordova.hellocordova
W/PluginManager: THREAD WARNING: exec() call to Hello.greet blocked
the main thread for 427ms. Plugin should use
CordovaInterface.getThreadPool(). 2019-02-07 19:03:50.478
18008-18008/io.cordova.hellocordova D/SystemWebChromeClient:
file:///android_asset/www/main.12e606c81a2773901da4.js: Line 1 : No
valid IP address identified 2019-02-07 19:03:50.478
18008-18008/io.cordova.hellocordova I/chromium: [INFO:CONSOLE(1)] "No
valid IP address identified", source:
file:///android_asset/www/main.12e606c81a2773901da4.js (1) 2019-02-07
19:03:50.524 18008-18008/io.cordova.hellocordova D/ScrollView:
initGoToTop 2019-02-07 19:03:50.541
18008-18008/io.cordova.hellocordova D/ScrollView: initGoToTop
2019-02-07 19:03:50.576 18008-18008/io.cordova.hellocordova
D/InputTransport: Input channel constructed: fd=144 2019-02-07
19:03:50.577 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#8df3f50[MainActivity]: setView =
DecorView#4388549[MainActivity] TM=true MM=false 2019-02-07
19:03:50.594 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#8df3f50[MainActivity]: dispatchAttachedToWindow
2019-02-07 19:03:50.637 18008-18008/io.cordova.hellocordova V/Surface:
sf_framedrop debug : 0x4f4c, game : true, logging : 0 2019-02-07
19:03:50.638 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#8df3f50[MainActivity]: Relayout returned:
old=[0,0][0,0] new=[18,475][702,853] result=0x7 surface={valid=true
3271704576} changed=true 2019-02-07 19:03:50.641
18008-18092/io.cordova.hellocordova D/mali_winsys: EGLint
new_window_surface(egl_winsys_display *, void *, EGLSurface,
EGLConfig, egl_winsys_surface **, egl_color_buffer_format *,
EGLBoolean) returns 0x3000, [812x506]-format:1 2019-02-07
19:03:50.641 18008-18092/io.cordova.hellocordova D/OpenGLRenderer:
eglCreateWindowSurface = 0xc43054b8, 0xc3024008 2019-02-07
19:03:50.662 18008-18008/io.cordova.hellocordova D/ScrollView: onsize
change changed 2019-02-07 19:03:50.663
18008-18008/io.cordova.hellocordova D/ScrollView: onsize change
changed 2019-02-07 19:03:50.670 18008-18014/io.cordova.hellocordova
I/zygote: Do full code cache collection, code=92KB, data=108KB
2019-02-07 19:03:50.670 18008-18014/io.cordova.hellocordova I/zygote:
After code cache collection, code=88KB, data=75KB 2019-02-07
19:03:50.672 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#8df3f50[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1
2019-02-07 19:03:50.698 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#8df3f50[MainActivity]: MSG_RESIZED_REPORT:
frame=Rect(18, 475 - 702, 853) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0,
0) or=1 2019-02-07 19:03:50.713 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#a469c78[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0
2019-02-07 19:03:52.360 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#8df3f50[MainActivity]: ViewPostIme pointer 0 2019-02-07
19:03:52.448 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#8df3f50[MainActivity]: ViewPostIme pointer 1 2019-02-07
19:03:52.489 18008-18092/io.cordova.hellocordova D/OpenGLRenderer:
eglDestroySurface = 0xc43054b8, 0xc3024000 2019-02-07 19:03:52.489
18008-18008/io.cordova.hellocordova
D/ViewRootImpl#8df3f50[MainActivity]: dispatchDetachedFromWindow
2019-02-07 19:03:52.489 18008-18008/io.cordova.hellocordova
D/InputEventReceiver: channel '1942219
io.cordova.hellocordova/io.cordova.hellocordova.MainActivity (client)'
~ Disposing input event receiver. 2019-02-07 19:03:52.489
18008-18008/io.cordova.hellocordova D/InputEventReceiver: channel
'1942219 io.cordova.hellocordova/io.cordova.hellocordova.MainActivity
(client)' ~NativeInputEventReceiver. 2019-02-07 19:03:52.502
18008-18008/io.cordova.hellocordova D/InputTransport: Input channel
destroyed: fd=144 2019-02-07 19:03:52.504
18008-18008/io.cordova.hellocordova D/SystemWebChromeClient:
file:///android_asset/www/main.12e606c81a2773901da4.js: Line 1 :
/10.0.0.0 2019-02-07 19:03:52.505 18008-18008/io.cordova.hellocordova
I/chromium: [INFO:CONSOLE(1)] "/10.0.0.0", source:
file:///android_asset/www/main.12e606c81a2773901da4.js (1) 2019-02-07
19:03:52.506 18008-18008/io.cordova.hellocordova
D/SystemWebChromeClient:
file:///android_asset/www/main.12e606c81a2773901da4.js: Line 1 :
http://10.0.0.0:3000 2019-02-07 19:03:52.506
18008-18008/io.cordova.hellocordova I/chromium: [INFO:CONSOLE(1)]
"http://10.0.0.0:3000", source:
file:///android_asset/www/main.12e606c81a2773901da4.js (1) 2019-02-07
19:03:52.512 18008-18008/io.cordova.hellocordova
D/ViewRootImpl#a469c78[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1
2019-02-07 19:03:52.516 18008-18008/io.cordova.hellocordova
E/ViewRootImpl: sendUserActionEvent() returned. 2019-02-07
19:03:52.517 18008-18008/io.cordova.hellocordova D/CordovaWebViewImpl:
onPageFinished(file:///android_asset/www/#/main/login) 2019-02-07
19:03:53.391 18008-18014/io.cordova.hellocordova I/zygote: Do partial
code cache collection, code=125KB, data=110KB 2019-02-07 19:03:53.391
18008-18014/io.cordova.hellocordova I/zygote: After code cache
collection, code=125KB, data=110KB 2019-02-07 19:03:53.392
18008-18014/io.cordova.hellocordova I/zygote: Increasing code cache
capacity to 512KB 2019-02-07 19:04:22.360
18008-18008/io.cordova.hellocordova V/InputMethodManager: Starting
input: tba=android.view.inputmethod.EditorInfo#5fb2d05 nm :
io.cordova.hellocordova ic=null 2019-02-07 19:04:22.360
18008-18008/io.cordova.hellocordova D/InputMethodManager:
startInputInner - Id : 0 2019-02-07 19:04:22.360
18008-18008/io.cordova.hellocordova I/InputMethodManager:
startInputInner - mService.startInputOrWindowGainedFocus 2019-02-07
19:04:22.362 18008-18008/io.cordova.hellocordova D/InputTransport:
Input channel constructed: fd=137 2019-02-07 19:04:22.362
18008-18008/io.cordova.hellocordova D/InputTransport: Input channel
destroyed: fd=107 2019-02-07 19:04:22.736
18008-18008/io.cordova.hellocordova D/CordovaActivity: Paused the
activity. 2019-02-07 19:04:22.757 18008-18008/io.cordova.hellocordova
D/CordovaActivity: Stopped the activity.

App crash on Facebook login using facebook4 plugin for phonegap on android

I have a phonegap hybrid app with Facebook connect plugin. First time when I login then the FB login works but after I logout and then again try to login via Facebook then the app crashes with the following Logcat results :
Plugin URL :
https://github.com/jeduan/cordova-plugin-facebook4
06-18 21:31:50.071 3129-3219/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9b2370a0
06-18 21:31:50.096 3129-3129/? I/Choreographer: Skipped 39 frames! The application may be doing too much work on its main thread.
06-18 21:31:50.104 3129-3234/? D/EGL_emulation: eglMakeCurrent: 0x9e677300: ver 2 0 (tinfo 0xaa366e80)
06-18 21:31:50.356 3129-3129/? D/CordovaActivity: Incoming Result. Request code = 64206
06-18 21:31:50.356 3129-3129/? D/CordovaInterfaceImpl: Sending activity result to plugin
06-18 21:31:50.356 3129-3129/? D/ConnectPlugin: activity result in plugin: requestCode(64206), resultCode(-1)
06-18 21:31:50.372 3129-3129/? D/com.facebook.FacebookSdk: getGraphApiVersion: v3.0
06-18 21:31:50.372 3129-3129/? D/com.facebook.FacebookSdk: getGraphApiVersion: v3.0
06-18 21:31:50.378 3129-3129/? D/CordovaActivity: Resumed the activity.
06-18 21:31:50.379 3129-3129/? W/com.facebook.appevents.AppEventsLogger: activateApp events are being logged automatically. There's no need to call activateApp explicitly, this is safe to remove.
06-18 21:31:50.551 3129-3219/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0x98eed520
06-18 21:31:51.043 3129-3129/? D/AndroidRuntime: Shutting down VM
--------- beginning of crash
06-18 21:31:51.044 3129-3129/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sqlchild.app1, PID: 3129
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.indexOf(int)' on a null object reference
at libcore.net.UriCodec.decode(UriCodec.java:153)
at java.net.URLDecoder.decode(URLDecoder.java:60)
at org.apache.cordova.facebook.ConnectPlugin.makeGraphCall(ConnectPlugin.java:751)
at org.apache.cordova.facebook.ConnectPlugin.access$200(ConnectPlugin.java:55)
at org.apache.cordova.facebook.ConnectPlugin$2$1.onCompleted(ConnectPlugin.java:111)
at com.facebook.GraphRequest$1.onCompleted(GraphRequest.java:301)
at com.facebook.GraphRequest$5.run(GraphRequest.java:1380)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
06-18 21:31:51.052 1667-2063/? W/ActivityManager: Force finishing activity com.sqlchild.app1/.MainActivity
06-18 21:31:51.067 1259-1321/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 589824
[ 06-18 21:31:51.097 1667: 2063 D/ ]
HostConnection::get() New Host Connection established 0x9aa0cc00, tid 2063
[ 06-18 21:31:51.099 1667: 2063 W/ ]
Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1
06-18 21:31:51.113 1259-1259/? E/EGL_emulation: tid 1259: eglCreateSyncKHR(1881): error 0x3004 (EGL_BAD_ATTRIBUTE)
06-18 21:31:51.199 1667-1667/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12502 waiters=0 for 133ms
06-18 21:31:51.289 1667-1677/? I/art: Background partial concurrent mark sweep GC freed 36018(2MB) AllocSpace objects, 1(20KB) LOS objects, 33% free, 7MB/11MB, paused 3.358ms total 105.317ms
06-18 21:31:51.381 1667-1729/? I/OpenGLRenderer: Initialized EGL, version 1.4
06-18 21:31:51.390 1667-1729/? D/EGL_emulation: eglCreateContext: 0xa07fc120: maj 2 min 0 rcv 2
06-18 21:31:51.414 1667-1729/? D/EGL_emulation: eglMakeCurrent: 0xa07fc120: ver 2 0 (tinfo 0xa0ea42f0)
06-18 21:31:51.484 1667-1729/? D/EGL_emulation: eglMakeCurrent: 0xa07fc120: ver 2 0 (tinfo 0xa0ea42f0)
06-18 21:31:51.691 1667-3205/? I/AccountManagerService: getTypesVisibleToCaller: isPermitted? true
06-18 21:31:51.698 1667-1683/? W/ActivityManager: Activity pause timeout for ActivityRecord{21fdafb u0 com.sqlchild.app1/.MainActivity t8 f}
06-18 21:31:51.877 1667-3206/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityStack$ActivityStackHandler.handleMessage(android.os.Message) from ActivityStack.java:283 waiters=0 for 175ms
06-18 21:31:51.896 1667-1683/? I/ActivityManager: Killing 2545:com.android.keychain/1000 (adj 15): empty #17
06-18 21:31:52.070 2029-2239/? D/EGL_emulation: eglMakeCurrent: 0xae594600: ver 2 0 (tinfo 0xae5924b0)
06-18 21:31:59.062 3129-3129/? I/Process: Sending signal. PID: 3129 SIG: 9
06-18 21:31:59.075 1667-1729/? D/EGL_emulation: eglMakeCurrent: 0xa07fc120: ver 2 0 (tinfo 0xa0ea42f0)
06-18 21:31:59.079 1667-1729/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9e8d1360
06-18 21:31:59.128 1667-3206/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 104)
06-18 21:31:59.130 1667-1721/? W/InputDispatcher: channel '7f56d84 com.sqlchild.app1/com.sqlchild.app1.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
06-18 21:31:59.130 1667-1721/? E/InputDispatcher: channel '7f56d84 com.sqlchild.app1/com.sqlchild.app1.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
06-18 21:31:59.129 1667-3206/? W/InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 3129 uid 10061
06-18 21:31:59.132 1667-1721/? W/InputDispatcher: channel 'e76402c com.sqlchild.app1/com.facebook.FacebookActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
06-18 21:31:59.133 1667-1721/? E/InputDispatcher: channel 'e76402c com.sqlchild.app1/com.facebook.FacebookActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
06-18 21:31:59.153 1667-3206/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 104)
06-18 21:31:59.168 1667-1680/? I/WindowState: WIN DEATH: Window{e76402c u0 com.sqlchild.app1/com.facebook.FacebookActivity}
06-18 21:31:59.169 1667-1680/? W/InputDispatcher: Attempted to unregister already unregistered input channel 'e76402c com.sqlchild.app1/com.facebook.FacebookActivity (server)'
06-18 21:31:59.174 1667-2280/? D/GraphicsStats: Buffer count: 3
06-18 21:31:59.207 1667-1681/? I/ActivityManager: Process com.sqlchild.app1 (pid 3129) has died
06-18 21:31:59.257 1667-3110/? I/WindowState: WIN DEATH: Window{7f56d84 u0 com.sqlchild.app1/com.sqlchild.app1.MainActivity}
06-18 21:31:59.257 1667-3110/? W/InputDispatcher: Attempted to unregister already unregistered input channel '7f56d84 com.sqlchild.app1/com.sqlchild.app1.MainActivity (server)'

android version compatibility

The question is myapp sometimes run well and sometimes doesn't.I used ionic+cordova+angular to do it. It does not work at 5.0.1 version.
This is the logcat when i test with android studio
07-28 15:55:19.894 9987-9987/? E/Zygote: MountEmulatedStorage()
07-28 15:55:19.894 9987-9987/? E/Zygote: v2
07-28 15:55:19.904 9987-9987/? E/Zygote: accessInfo : 0
07-28 15:55:19.904 9987-9987/? E/SELinux: [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
07-28 15:55:20.084 9987-9987/io.ionic.starter E/SysUtils: ApplicationContext is null in ApplicationStatus
07-28 15:55:20.164 9987-9987/io.ionic.starter E/chromium: [ERROR:browser_gpu_channel_host_factory.cc(258)] Failed to init browser shader disk cache.
07-28 15:55:20.194 9987-9987/io.ionic.starter E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
07-28 15:55:20.194 9987-10081/io.ionic.starter E/ActivityThread: Failed to find provider info for com.google.settings
ionic cordova plugin add cordova-plugin-crosswalk-webview --save Add this will be work.

Categories