Jump to content
Android Forum - A Community For Android Users and Enthusiasts

My android app crashing only on Samsung devices. How can I solve it?


Nasif Ahmed
 Share

Recommended Posts

I have an app on play store(my first app). My first version didn't crash. But when I released my second version it is crashing only on Samsung devices. I tested it on my no brand jelly bean device and on emulator and it is working perfectly. I have no Samsung devices. What can I do now?

 

I think it is crashing on launcher activity. My Launcher activity is Main. This is a splash screen. Code and error are provided below.

App Name : Rebel Poet Nazrul
package name : com.xplosive.rebelpoetnazrul

Copied from play store stack traces

 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xplosive.rebelpoetnazrul/com.xplosive.rebelpoetnazrul.Main}: java.lang.NullPointerException
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
    at android.app.ActivityThread.access$600(ActivityThread.java:128)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4517)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.NullPointerException
    at com.xplosive.rebelpoetnazrul.Main.onCreate(Main.java:56)
    at android.app.Activity.performCreate(Activity.java:4470)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
    ... 11 more

Main.java

package com.xplosive.rebelpoetnazrul;
   
    import android.app.Activity;
    import android.content.Intent;
    import android.graphics.Typeface;
    import android.media.MediaPlayer;
    import android.os.Bundle;
    import android.widget.TextView;
    import androidbangladesh.bengali.support.BengaliUnicodeString;
   
    public class Main extends Activity {
   
                MediaPlayer mp;
   
                TextView tvBanner, tv1;
                Typeface font;
   
                String banner, version, develop, developer;
   
                @Override
                protected void onCreate(Bundle savedInstanceState) {
                                super.onCreate(savedInstanceState);
   
                                // ActionBar actionBar = getActionBar();
                                // actionBar.setDisplayHomeAsUpEnabled(true);
                                // actionBar.setBackgroundDrawable(new ColorDrawable(Color
                                // .parseColor("#6699FF")));
                                // actionBar.setBackgroundDrawable(new ColorDrawable(Color.GREEN));
   
                                setContentView(R.layout.activity_main);
                                setTitle("বিদ্রোহী কবি নজরুল");
   
                                initialize();
   
                                banner = "বিদ্রোহী কবি নজরুল";
                                version = "ভার্সন ২.০";
                                develop = "Developed By";
                                developer = "Xplo";
   
                                int apiVersion = android.os.Build.VERSION.SDK_INT;
   
                                if (apiVersion < 16) {
                                                BengaliUnicodeString.getBengaliUTF(Main.this, banner, tvBanner);
                                                BengaliUnicodeString.getBengaliUTF(Main.this, version, tv1);
   
                                } else {
                                                tvBanner.setTypeface(font);
                                                tv1.setTypeface(font);
   
                                                tvBanner.setText(banner);
                                                tv1.setText(version);
   
                                }
   
                                mp = MediaPlayer.create(getApplicationContext(), R.raw.startup);
                                //mp = MediaPlayer.create(Main.this, R.raw.startup);
                               
                                mp.start();
   
                                Thread timer = new Thread() {
                                                public void run() {
                                                                try {
                                                                                sleep(2000);
                                                                } catch (Exception e) {
                                                                                e.printStackTrace();
   
                                                                } finally {
   
                                                                                Intent intent = new Intent(Main.this,
                                                                                                                MainMenuActivity.class);
   
                                                                                startActivity(intent);
                                                                }
                                                };
                                };
   
                                timer.start();
   
                }
   
                private void initialize() {
                                font = Typeface.createFromAsset(getAssets(), "solaimanlipinormal.ttf");
                                tvBanner = (TextView) findViewById(R.id.tvBanner);
                                tv1 = (TextView) findViewById(R.id.textView1);
   
                }
   
                @Override
                protected void onPause() {
   
                                super.onPause();
                                mp.release();
                                // mp.stop(); //this is not working
                                finish();
   
                }
   
    }

activity_main.xml

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#66CCFF"
        android:gravity="center"
        android:orientation="vertical"
        tools:context=".MainActivity" >
   
        <TextView
            android:id="@+id/tvBanner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="বিদ্রোহী কবি নজরুল"
            android:textColor="@color/banner"
            android:textSize="35sp" />
   
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="ভার্সন ২.০"
            android:textColor="@color/banner"
            android:textSize="15sp" />
   
        <Space
            android:layout_width="match_parent"
            android:layout_height="40dp" />
   
        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Developed By"
            android:textColor="@color/banner"
            android:textSize="20sp" />
   
        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Xplo"
            android:textColor="@color/banner"
            android:textSize="30sp" />
   
    </LinearLayout>

Crash Device list

 Galaxy S DUOS (kyleopen)
    Galaxy Grand duos (baffin)
    Galaxy Tab3 8.0 (lt013g)
    Galaxy Core (arubaslim)
    nuclear-t03
    Galaxy Note3 (hlte)
    Galaxy S3 Mini (golden)
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Find out which of the variables used in Line 56 (for me it's 55, but anyway, it seems to be the media player one...) is throwing the null pointer. If you don't have the samsung device yourself you can either use the samsung emulator:

 

http://developer.samsung.com/android/technical-docs/Using-Samsung-Emulators-for-Android-Application-Development

 

or simply publishe a new version that logs all pointers before executing that line like

 

if (x == NULL){

  Log.w(x, "is NULL");

}

Link to comment
Share on other sites

You need to go to Customer Service Center to have a check out, last time my phone battery life only goes one day after using a movie search APK,it runs automatically after starting.  I couldn't remove it so I bought WIWOFIT Wireless Charger from Amazon to charge any time I don't use, the problem settled but I finally went to after sales service center to delete that APK

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...