6

My app doesn't start on Huawei P8 Lite, but it works fine on other devices. I searched for the problem a long time, but I couldn't find a solution that works.

My app ran all the time without problems. Then I fixed a few problems and got the startup crash on Huawei P8 Lite. I don't get it.

LogCat:

? W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.huawei.lcagent.client.LogCollectManager.getUserType()' on a null object reference
? W/System.err:     at com.android.server.util.ReportTools.getUserType(ReportTools.java:86)
? W/System.err:     at com.android.server.util.ReportTools.isBetaUser(ReportTools.java:73)
? W/System.err:     at com.android.server.util.ReportTools.report(ReportTools.java:58)
? W/System.err:     at com.android.server.util.HwUserBehaviourRecord.appExitRecord(HwUserBehaviourRecord.java:65)
? W/System.err:     at com.android.server.am.ActivityManagerService$UiHandler.handleMessage(ActivityManagerService.java:1572)
? W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
? W/System.err:     at android.os.Looper.loop(Looper.java:150)
? W/System.err:     at android.os.HandlerThread.run(HandlerThread.java:61)
? W/System.err:     at com.android.server.ServiceThread.run(ServiceThread.java:46)
 E/ReportTools: This is not beta user build
? I/Process: Sending signal. PID: 10115 SIG: 9
? I/PgedBinderListener: kstate callback type:8 value1=10115 value2=KILLED

This is my Manifest (without all activities):

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="prestigetower.nextgendevelopers.prestigetower">

    <uses-permission android:name="com.android.vending.BILLING"/>
    <uses-ermission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <application
        android:allowBackup="false"
        android:icon="@mipmap/enemy_175"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:hardwareAccelerated="false"
        android:largeHeap="true"
        android:debuggable="false"
        android:name="android.support.multidex.MultiDexApplication">

        <meta-data android:name="com.google.android.gms.version"
                   android:value="@integer/google_play_services_version" />
       <supports-screens
            android:smallScreens="true"
            android:normalScreens="true"
            android:largeScreens="true"
            android:xlargeScreens="true" />

        <service
            android:enabled="true"
            android:name="BackgroundSoundService" />

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.Transparent"
            android:screenOrientation="portrait"
            >

            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            android:theme="@android:style/Theme.Translucent" />

        <!-- END -->
    </application>
</manifest>

And this is my Build Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "prestigetower.nextgendevelopers.prestigetower"
        minSdkVersion 18
        targetSdkVersion 25
        versionName 'Version 0.9.3.3'
        versionCode 933
        multiDexEnabled true
    }

    buildTypes {

        debug {
            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    productFlavors {

    }

    dexOptions {
        javaMaxHeapSize "4g"
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:support-v4:25.0.0'
    compile 'com.android.support:support-v13:25.0.0'
    compile 'com.android.support:design:25.0.0'
    compile 'com.android.support:recyclerview-v7:25.0.0'
    compile 'com.android.support:support-annotations:25.0.0'
    compile 'com.android.support:percent:25.0.0'
    compile 'com.android.support:cardview-v7:25.0.0'
    compile 'com.anjlab.android.iab.v3:library:1.0.+'
    compile 'com.google.android.gms:play-services:10.2.4'
    compile 'com.google.android.gms:play-services-ads:10.2.4'

    testCompile 'junit:junit:4.12'
}
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

1 Answers1

5

After some research I found out that Huawei doesn't show you everything inside LOGs when you upgrade to Android M on Huawei P8 Lite (I tested it on Mate 20 Pro with Android P and I see everything).

So the actual problem is always hidden under these strange Huawei Logs

To show everything in logcat you have to type inside dialer special code:

*#*#2846579#*#*

Then you should see this settings screen:

enter image description here

Go to Background Settings

enter image description here

Click on LOG Settings and adjust logs to your needs

Adrian Kapuscinski
  • 1,124
  • 12
  • 13