Jump to content

Android E/BitmapFactory: drm.service.enabled true


fiveworlds

Recommended Posts

I am writing an android application and the debbuger is throwing and error.

E/BitmapFactory: drm.service.enabled true

Does anybody know how to get rid of the message properly? I was looking online but I couldn't find many references about that specific error I did see there is a drm library https://developer.android.com/reference/android/drm/package-summary so maybe enabling that would work. All the bitmaps used in my app were drawn by me.

Link to comment
Share on other sites

2 hours ago, fiveworlds said:

It isn't giving me a line number that is the annoying part.

Old-school debugging (I am using it all-the-time every day, as I am old-school creator ;) ) method is to add lines which print text and/or numbers e.g.

printf( "1\n" );
[..code..]
printf( "2\n" );
[..code..]
printf( "3\n" );
[..code..]
printf( "4\n" );
[..code..]
printf( "5\n" );

Add equivalent in your app, run it, and you will see which part of code is causing issue ("drm.service.enabled true" will be between your debugging texts/numbers). (multi-threading could complicate it a bit)

In the first stage, it does not have to be at every single line. It could be at the begging of function (or method) and at the end of function, to learn which function is troublesome. Then fill function with more denser debugging. After learning troublesome line, remove debugging lines.

 

See debugging info couple lines above error lines there are warnings about unresolved methods. If you see such, you should check Android SDK website to check which API is needed to call them e.g.

"setTintMode

added in API level 21

public void setTintMode (PorterDuff.Mode tintMode)

Specifies a tint blending mode for this drawable.

Defines how this drawable's tint color should be blended into the drawable before it is drawn to screen. Default tint mode is PorterDuff.Mode.SRC_IN."

The same setTintList() API level 21.

You should use something like

if( Build.VERSION.SDK_INT >= 21 ) { ... }

or API names, instead of numbers, from Build.VERSION_CODES

https://developer.android.com/reference/android/os/Build.VERSION_CODES

 

Edited by Sensei
Link to comment
Share on other sites

Quote

Old-school debugging (I am using it all-the-time every day, as I am old-school creator ;)

That was a good idea so with the line numbers added I can see it is being thrown by setContentView(activity_login.xml)

So that file is very basic. I just have 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/grey_100"
    android:orientation="vertical"
    android:weightSum="4">

    <LinearLayout
        android:id="@+id/linearLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="40dp"
        android:orientation="vertical"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="72dp"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="40dp"
            android:layout_marginBottom="40dp"
            android:drawableStart="@mipmap/ic_launcher"
            android:drawablePadding="10dp"
            android:fontFamily="@font/tinos"
            android:text="@string/logo_title"
            android:textColor="#903"
            android:textSize="30sp"
            android:typeface="normal"
            tools:layout_editor_absoluteX="185dp"
            tools:layout_editor_absoluteY="32dp" />

        <com.google.android.gms.common.SignInButton
            android:id="@+id/signInButton"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:visibility="visible"
            tools:visibility="gone">

        </com.google.android.gms.common.SignInButton>

        <com.facebook.login.widget.LoginButton
            android:id="@+id/login_button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="30dp"
            android:layout_marginBottom="30dp" />
    </LinearLayout>

</RelativeLayout>

If I look at the error message it appears to be thrown as I am loading the google+ sign in button. (I am using google+ and facebook login)

 

Capture.PNG

Link to comment
Share on other sites

I would use comment in XML i.e. <!---- ..... --->

to disable the first android.gms.common.SignInButton (compile and check logs),

and then disable second com.facebook.login.widget.LoginButton..

then both..

To check which one, or both, are causing issue..

What are privileges required by login/sign in buttons?

 

Link to comment
Share on other sites

Okay so disabling the buttons showed that the latest dependencies had problems downloading.

I changed

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-core:16.0.5'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.android.gms:play-services-places:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-database:16.0.5'
    implementation 'com.google.firebase:firebase-firestore:17.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.google.code.gson:gson:2.8.4'
    implementation 'org.jboss.spec.javax.net.ssl:jboss-jsse-api_8.0_spec:1.0.0.Final'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.facebook.android:facebook-login:[4,5)'
}

to

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:animated-vector-drawable:27.1.1'
    implementation 'com.android.support:exifinterface:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    implementation 'com.android.support:support-media-compat:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.android.gms:play-services-places:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-database:16.0.4'
    implementation 'com.google.firebase:firebase-firestore:17.1.2'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
    testImplementation 'junit:junit:4.12'
}

and there is no longer errors in the emulator. I am still getting errors on my phone though but it is an old android version (4)

Capture.PNG

Link to comment
Share on other sites

3 minutes ago, fiveworlds said:

and there is no longer errors in the emulator. I am still getting errors on my phone though but it is an old android version (4)

Try running emulator configured to the same version as your target device. If you will use method not existing in old API, it will obviously cause crash.

 

Link to comment
Share on other sites

Quote

I meant configure emulator to the same Android API level as is in your physical device.

Yeah I did that but my app uses a newer version of google play services than the emulator at the same API level (19) as my device has so the app won't start.

Link to comment
Share on other sites

23 hours ago, fiveworlds said:

I am still getting errors on my phone though but it is an old android version (4)

If you're getting crashes (and application is shutdown) you can try to surround potentially crashing code by e.g.

try {
	[..code which is crashing..]
} catch( Exception e ) {
	Log.e( TAG, Log.getStackTraceString( e ) );
	// or
	Log.e( TAG, MSG, e );
}

Prevent shutdown of application. Replace it by user-friendly error message.

5 hours ago, fiveworlds said:

Yeah I did that but my app uses a newer version of google play services than the emulator at the same API level (19) as my device has so the app won't start.

Then do what I said in the 2nd post and surround code by e.g.

if( Build.VERSION.SDK_INT >= 21 ) { ... }

 

 

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.