App works on some phones and not on others

why are my apps not working on my android
android phone problems and solutions
how do i fix an android app that is not responding
why is google not working on my phone
how do mobile apps work
how do you fix an app that won t open?
how do apps work on android
cell phone troubleshooting and repair

The app I have been working on for quite some time now seems to work on my phone, but when I install it on other phones it either shows up properly, show up partially, or it won't open at all for some reason. I have checked the manifest:

<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:theme="@style/AppTheme">
    <activity android:name=".activities.Checkbox">
    </activity>
    <activity android:name=".activities.InputActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".activities.ReviewActivity">
    </activity>
</application>

Note that API level on my phone is 27, it works, I have tried on other Android 8 phones, on some it works, on some it works partially (see picture below, a button is missing), and on some phones the app opens, is blank for a second or two and then closes.

What you should normally have on the first activity:

What is on a Huawei P9 (see the missing button):

And on other phones the app installs but simply won't show the first activity, and will close in a few seconds with no crash.

Here is the XML code for first activity:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_10">

<View
    android:layout_width="match_parent"
    android:layout_height="160dp"
    android:background="@color/colorPrimary" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerInParent="true"
    android:orientation="vertical"
    android:padding="@dimen/spacing_mlarge">

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/spacing_middle"
        android:visibility="visible"
        app:cardCornerRadius="6dp"
        app:cardElevation="5dp">
        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="@dimen/spacing_mlarge">

            <TextView
                android:id="@+id/input_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginBottom="@dimen/spacing_xlarge"
                android:layout_marginTop="@dimen/spacing_middle"
                android:text="Bienvenue sur MBTouch!"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"
                android:textColor="@color/green_500"
                android:textStyle="bold" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Numéro d'identification:"
                android:textAlignment="center"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
                android:textColor="@color/grey_40" />

            <android.support.design.widget.TextInputEditText
                android:id="@+id/input_identif"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="-4dp"
                android:layout_marginRight="-4dp"
                android:maxLength="50"
                android:maxLines="1"
                android:singleLine="true"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"
                android:textColor="@color/blue_600"
                android:theme="@style/EditText.Grey" />

            <View
                android:layout_width="0dp"
                android:layout_height="@dimen/spacing_mlarge" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Date de naissance (jj/mm/aaaa):"
                android:textAlignment="center"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
                android:textColor="@color/grey_40" />

            <android.support.design.widget.TextInputEditText
                android:id="@+id/input_naiss"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="date"
                android:layout_marginLeft="-4dp"
                android:layout_marginRight="-4dp"
                android:maxLength="50"
                android:maxLines="1"
                android:singleLine="true"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"
                android:textColor="@color/blue_600"
                android:theme="@style/EditText.Grey" />

            <View
                android:layout_width="0dp"
                android:layout_height="@dimen/spacing_mlarge" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Poids (kg.g) (ex: 84.2):"
                android:textAlignment="center"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
                android:textColor="@color/grey_40" />

            <android.support.design.widget.TextInputEditText
                android:id="@+id/input_poids"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="numberDecimal"
                android:layout_marginLeft="-4dp"
                android:layout_marginRight="-4dp"
                android:maxLength="50"
                android:maxLines="1"
                android:singleLine="true"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"
                android:textColor="@color/blue_600"
                android:theme="@style/EditText.Grey" />

            <View
                android:layout_width="0dp"
                android:layout_height="@dimen/spacing_mlarge" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Taille (m.cm) (ex: 1.82):"
                android:textAlignment="center"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
                android:textColor="@color/grey_40" />

            <android.support.design.widget.TextInputEditText
                android:id="@+id/input_taille"
                android:layout_width="match_parent"
                android:inputType="numberDecimal"
                android:layout_height="wrap_content"
                android:layout_marginLeft="-4dp"
                android:layout_marginRight="-4dp"
                android:maxLength="50"
                android:maxLines="1"
                android:singleLine="true"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"
                android:textColor="@color/blue_600"
                android:theme="@style/EditText.Grey" />

            <Button
                android:id="@+id/input_start"
                android:layout_width="match_parent"
                android:layout_height="55dp"
                android:onClick="onContinue"
                android:layout_marginLeft="-4dp"
                android:layout_marginRight="-4dp"
                android:background="@drawable/btn_rounded_primary"
                android:text="Commencer"
                android:textAllCaps="false"
                android:textColor="@android:color/white"
                android:textStyle="bold" />

            <View
                android:layout_width="0dp"
                android:layout_height="@dimen/spacing_mlarge" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="Application conçue par S.C. iNeedHelp S.R.L."
                android:gravity="center_horizontal"
                android:textAlignment="center"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
                android:textColor="@color/grey_40" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="On vous attend sur https://ineedhelp.be/ !"
                android:gravity="center_horizontal"
                android:textAlignment="center"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
                android:textColor="@color/grey_40" />

            <ImageView
                android:layout_width="180dp"
                android:layout_height="60dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginBottom="@dimen/spacing_mlarge"
                android:layout_marginTop="@dimen/spacing_large"
                android:src="@drawable/ineedhelp"/>

        </LinearLayout>
        </ScrollView>
    </android.support.v7.widget.CardView>

    <View
        android:layout_width="0dp"
        android:layout_height="@dimen/spacing_large" />

</LinearLayout>

And here is the Java for the first activity:

public class InputActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().hide();
    setContentView(R.layout.activity_input);
}

public void onContinue(View v){
    EditText i = (EditText) findViewById(R.id.input_identif);
    EditText d = (EditText) findViewById(R.id.input_naiss);
    EditText p = (EditText) findViewById(R.id.input_poids);
    EditText t = (EditText) findViewById(R.id.input_taille);

    String ident = i.getText().toString();
    String date = d.getText().toString();
    String poids = p.getText().toString();
    String taille = t.getText().toString();

    if (ident.equals("")) {
        Toast.makeText(getApplicationContext(),"Le numéro d'identification ne peut pas être vide!",
                Toast.LENGTH_SHORT).show();
    } else {
        if (!isValidDate(date)) {
            Toast.makeText(getApplicationContext(),"Veuillez introduire une date au format JJ/MM/AAAA (ex: 12/10/1975).",
                    Toast.LENGTH_SHORT).show();
        } else {
            if(!isValidDouble(poids)){
                Toast.makeText(getApplicationContext(),"Veuillez introduire un nombre (avec un point, pas de virgule) pour le poids (ex: 75.3).",
                        Toast.LENGTH_SHORT).show();
            } else {
                if(!isValidDouble(taille)){
                    Toast.makeText(getApplicationContext(),"Veuillez introduire un nombre (avec un point, pas de virgule) pour la taille (ex: 1.85).",
                            Toast.LENGTH_SHORT).show();
                } else {
                    Double tl = Double.parseDouble(taille.trim());
                    Double po = Double.parseDouble(poids.trim());
                    Intent mIntent = new Intent(this, Checkbox.class);
                    mIntent.putExtra("identification", ident);
                    mIntent.putExtra("date", date);
                    mIntent.putExtra("poids", po.toString());
                    mIntent.putExtra("taille", tl.toString());
                    Double bmi = (po / (tl*tl));
                    mIntent.putExtra("bmi", bmi.toString());
                    Toast.makeText(getApplicationContext(),"BMI: " + bmi.toString(),
                            Toast.LENGTH_SHORT).show();
                    startActivity(mIntent);
                }
            }

        }
    }
}

public boolean isValidDate(String dateString) {
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {
        df.parse(dateString);
        return true;
    } catch (ParseException e) {
        return false;
    }
}

public boolean isValidDouble(String number) {
    try {
        Double.parseDouble(number.trim());
    }
    catch(NumberFormatException e){
        return false;
    }
    return true;
}

}

Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    defaultConfig {
        applicationId "ro.ineedhelp.patientquiz"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // google support library ---------------------------------------------------------------------
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    //noinspection GradleCompatible
    compile 'com.android.support:design:25.4.0'
    compile 'com.android.support:cardview-v7:25.4.0'
    compile 'com.android.support:recyclerview-v7:25.4.0'
    implementation 'com.android.support:appcompat-v7:25.4.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    compile 'com.android.support:support-v4:25.4.0'
    compile 'com.android.support:support-vector-drawable:25.4.0'

    // third party dependencies -------------------------------------------------------------------
    compile 'com.balysv:material-ripple:1.0.2'                  // ripple effect
    compile 'com.github.bumptech.glide:glide:3.7.0'             // image loader
    compile 'com.wdullaer:materialdatetimepicker:3.2.0'         // date & time picker
    compile 'com.mikhaellopez:circularimageview:3.0.2'          // circle image view
    compile 'com.github.pchmn:MaterialChipsInput:1.0.8'         // material chip
    compile 'com.hootsuite.android:nachos:1.1.1'                // material chips

    testCompile 'com.android.support:appcompat-v7:25.4.0'
}

Do you think you know what could cause this? I sign the APKs with Level1 and Level2 signature.

Thanks in advance.

Your button is missing on some phones because for some phones it's impossible to find android:background="@drawable/btn_rounded_primary" so your button isn't missing, it's just invisible. To check this you should change android:textColor of button. Then check that your drawable resourse "@drawable/btn_rounded_primary" is on the correct dirrectory. I need more information to understand, why does your app crash on some phones. Could you write me API level of those phones?

How to Fix The Apps Not Working on Android (Freezing & Crashing), . Hopefully you've already backed it up or are able to wireless back it up. Yes the app installs on other device but does not run it says App has stopped responding – stodgy.nerd Mar 26 '17 at 7:04

check your gradle file or project structure. may be your API version is higher than your destination device. select lower API would solve this problem

How can I tell if someone has linked my phone to theirs?, How do you know if someone is watching you on your phone? Android developers can determine specify for their applications both as far as programming (least OS adaptation, for instance) and equipment. For instance, an

Check the sdk versions of those phones on which the app is not working. The min sdk version of your app is 21, phones running sdk versions below 21 won't support the app.

5 Best Android Apps to Track Someone's Location, After each step, restart your phone to see if it fixed the issue. Note: You're using an older Android version. Some of these steps work only on Android 8.1 and up. While the above troubleshooting steps can help to fix most problems setting up the Your Phone app, the experience is still a work in progress, which means that some features and functionalities

All right, so I figured out what was wrong, apparently some phones don't like the option android:background on buttons, I have removed that and now it seems to work properly.

Fix an installed Android app that isn't working, If it's only a few apps, you might be able to repair the situation by deleting the The old uninstall-reinstall trick will also work on Android phones if the dead spot where no one can get any signal, or you're at home and other  The obvious way to tell is to try another set of known-good earphones on your phone. If they don’t work either, the problem is in your phone (possibly the jack, or somewhere else in the audio chain).

How to fix the most common smartphone problems, Essentially, this mode locks the phone's user inside one specific app, so However, if Guided Access doesn't quite work for you, there are a couple other But if you're still lacking some peace of mind and really don't trust  The S3 does support du, but it does not take some parameters such as -m (display in megabytes), while newer devices such as Moto G or even Samsung devices (past Galaxy S5) does support it. Try running ping -c 1 8.8.8.8 on adb shell within S3, and you'll note that it's not your Java code, it's the OEM.

Share your phone without letting friends snoop, If you have a smart phone or other mobile device, you probably use apps – to Not all apps work on all mobile devices. Some apps access only the data they need to function; others access data that's not related to the purpose of the app. Hi I have the HomeHub 4 at 40mbps with a number of devices connected wirelessly: tv, 2 iPads, 2 iPhones, 1 macbook and 1 laptop I'm having sporadic and irrational wireless connections on some devices though. For example, all the devices will work but randomly one of the iPhones won't work. Then la

Understanding Mobile Apps, If you are an Android user who has apps are not working on Android device, you device and error details and we will fix the problem with some other methods.

Comments
  • Yes, I have removed that line and left the basic android button and now it works on all phones. Thanks a lot. The phones that failed were Android 6.0
  • Have you tried to run app on those phones on debug mode and look for error description?
  • I don't have physical access to these phones unfortunately, I had to try them via some friends
  • Well, in Gradle it's set on SDK 25, minimum 21, and before I made some design changes the app worked on all phones. I have made these design changes (in XML file), and now it works only sometimes for some reason.
  • Obviously, but why is the button missing on the main activity on a Huawei P9 then? Android 7.1, same as my Samsung S5 RR. It works great on a OnePlus 5T