question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashed when launch any app/ android 9

See original GitHub issue

Hi. This is very strange bug, because app work is ok till I’m not launch, Youtube app. After launch app is crashed. If youtube already launched early and I’m open him, app is don’t crash.

If app isn’t in background and open Youtube, app don’t crash.

Tested on katzer and forks (tushe, etc) * Android 9 Xiami A1 (and emulator) * plugins: cordova-plugin-background-mode 0.7.2 “BackgroundMode” cordova-plugin-badge 0.8.8 “Badge” cordova-plugin-device 2.0.2 “Device” cordova-plugin-local-notification 0.9.2 “LocalNotification” cordova-plugin-netto 1.0.1 “Netto” cordova-plugin-openvpn 1.0.0 “OpenVPN” cordova-plugin-ping 0.3.1 “Ping” cordova-plugin-whitelist 1.3.3 “Whitelist” * Errors:

03-17 19:46:53.868  4325 17466 I bweb    : Failed closing connection
03-17 19:46:53.868  4325 17466 I bweb    : javax.net.ssl.SSLException: Write error: ssl=0x719fc80788: I/O error during system call, Broken pipe
03-17 19:46:53.868  4325 17466 I bweb    : 	at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_write(Native Method)
03-17 19:46:53.868  4325 17466 I bweb    : 	at com.google.android.gms.org.conscrypt.NativeSsl.write(:com.google.android.gms@15090039@15.0.90 (100408-231259764):4)
03-17 19:46:53.868  4325 17466 I bweb    : 	at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket$SSLOutputStream.write(:com.google.android.gms@15090039@15.0.90 (100408-231259764):6)
03-17 19:46:53.868  4325 17466 I bweb    : 	at bwph.a_(:com.google.android.gms@15090039@15.0.90 (100408-231259764):2)
03-17 19:46:53.868  4325 17466 I bweb    : 	at bwoq.a_(:com.google.android.gms@15090039@15.0.90 (100408-231259764):4)
03-17 19:46:53.868  4325 17466 I bweb    : 	at bwpk.close(:com.google.android.gms@15090039@15.0.90 (100408-231259764):2)
03-17 19:46:53.868  4325 17466 I bweb    : 	at bwfu.close(Unknown Source:6)
03-17 19:46:53.868  4325 17466 I bweb    : 	at bwdi.run(:com.google.android.gms@15090039@15.0.90 (100408-231259764):1)
03-17 19:46:53.868  4325 17466 I bweb    : 	at bwbz.run(:com.google.android.gms@15090039@15.0.90 (100408-231259764):2)
03-17 19:46:53.868  4325 17466 I bweb    : 	at rnb.run(:com.google.android.gms@15090039@15.0.90 (100408-231259764):21)
03-17 19:46:53.868  4325 17466 I bweb    : 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
03-17 19:46:53.868  4325 17466 I bweb    : 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
03-17 19:46:53.868  4325 17466 I bweb    : 	at rsw.run(Unknown Source:7)
03-17 19:46:53.868  4325 17466 I bweb    : 	at java.lang.Thread.run(Thread.java:764)
03-17 19:46:54.282 17870 17942 W YouTube : vwp: valueInCurrentMillis bad value: 0
03-17 19:46:54.282 17870 17942 W YouTube : 	at eav.b(SourceFile:14)
03-17 19:46:54.282 17870 17942 W YouTube : 	at dka.b(SourceFile:11)
03-17 19:46:54.282 17870 17942 W YouTube : 	at dll.run(SourceFile:312)
03-17 19:46:54.282 17870 17942 W YouTube : 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
03-17 19:46:54.282 17870 17942 W YouTube : 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
03-17 19:46:54.282 17870 17942 W YouTube : 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
03-17 19:46:54.282 17870 17942 W YouTube : 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
03-17 19:46:54.282 17870 17942 W YouTube : 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
03-17 19:46:54.282 17870 17942 W YouTube : 	at vvq.run(SourceFile:12)
03-17 19:46:54.282 17870 17942 W YouTube : 	at java.lang.Thread.run(Thread.java:764)

full logcat: logcat.txt … upd: Tested. App will crash if launch any Google App: Google Play, Youtube, Settngs, Instagram, even Calculator… upd 2: on Android 7 it’s work is ok

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:17

github_iconTop GitHub Comments

7reactions
serpauliuscommented, Jun 7, 2019

You can also add the permission to Ionic 3 / Cordova apps by adding this in your config.xml under android platform:

    <platform name="android">
        <config-file parent="./" target="app/src/main/AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android">
            <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
        </config-file>
    </platform>
2reactions
sarphervizcommented, Apr 4, 2019

I could run on android 9 1 - Change ForegroundService.java 2 - Add permission to AndroidManifest.xml

You can check the link : https://stackoverflow.com/questions/47531742/startforeground-fail-after-upgrade-to-android-8-1

1- ForegroundService.java

import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Color; import android.os.Binder; import android.os.Build; import android.os.IBinder; import android.os.PowerManager; import android.support.v4.app.NotificationCompat; import org.json.JSONObject; import java.lang.reflect.Method;

private void keepAwake() {
    JSONObject settings = BackgroundMode.getSettings();
    boolean isSilent    = settings.optBoolean("silent", false);

    if (!isSilent) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
            startMyOwnForeground();
        else
            startForeground(NOTIFICATION_ID, makeNotification());
    }

    PowerManager powerMgr = (PowerManager)
            getSystemService(POWER_SERVICE);

    wakeLock = powerMgr.newWakeLock(
            PowerManager.PARTIAL_WAKE_LOCK, "BackgroundMode");

    wakeLock.acquire();
}

private void startMyOwnForeground(){
    String NOTIFICATION_CHANNEL_ID = "com.yourapp.id";
    String channelName = "My Background Service";
    NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_NONE);
    chan.setLightColor(Color.BLUE);
    chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
    NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    assert manager != null;
    manager.createNotificationChannel(chan);

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
    Notification notification = notificationBuilder.setOngoing(true)
            //.setSmallIcon(R.drawable.icon_1)
            .setContentTitle("App is running in background")
            .setPriority(NotificationManager.IMPORTANCE_MIN)
            .setCategory(Notification.CATEGORY_SERVICE)
            .build();
    startForeground(2, notification);
} 

2 - AndroidManifest.xml

Give permission ForegroundService <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

Read more comments on GitHub >

github_iconTop Results From Across the Web

11 Quick Ways to Fix Apps Keep Crashing on Android - iMobie
Apps Keep Crashing on Android ; Click System Fix Function ; Start to Repair Samsung Phone ; Firmware Downloaded and Click Fix Now....
Read more >
How to Fix It When Apps Keep Crashing on Android - Lifewire
There are many common reasons an app may keep crashing on your Android. Try these fixes to solve this common problem.
Read more >
Crashes | Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
Why Do My Apps Keep Crashing on Android? - Avast
If an app keeps crashing unexpectedly, force the app to stop through settings, then open the app again. This is also how to...
Read more >
How to Fix the Google App Crashing on Android - MakeUseOf
Navigate to Settings > Apps to view all installed apps on your phone. · Select the app that has been causing you trouble...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found