我使用最低要求的Android Marshmallow使用Android Studio制作了一个应用...
应用程序可以在My Motorola Moto G6和OnePlus 6上完美运行!
但是它已安装但仍在Samsung J7 nxt,Redmi Note 4,Redmi Note 5上崩溃... 所有手机均为Android Oreo / Pie
有解决方案吗?
尝试重新安装并清除重新启动缓存的n个内容。
编辑:
我现在知道原因了!! 这是我的LoadingActivity.java
我在不加载活动的情况下编译了.apk [加载活动只是在应用程序启动时带有app_Logo的屏幕]。
这是我的代码,请让我知道怎么了。
完美适用于: 1.摩托罗拉Moto G6-Android 9 2.三星J7 NXT-Android 9 3. Oneplus 6-Android 9
加载活动于:崩溃 1. Samsung Galaxy Grand Max-Android 4.4.4 [确定太旧了] 2. Redmi Note 5-Android 8 3. Redmi注意事项4
代码: LoadingActivity.java(java类)
package com.androidapps.appname.Activities;
import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.androidapps.appname.R;
public class LoadingActivity extends AppCompatActivity {
private static int delay = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loading);
String samsung = "samsung";
String motorola = "motorola";
String oneplus = "oneplus";
String OnePlus = "OnePLus";
String Xiaomi = "Xioami";
String vivo = "vivo";
String VivoCaps = "Vivo";
String oppo = "oppo";
String oppoCaps = "OPPO";
//Assigning Processes
if (Build.MANUFACTURER.equals(motorola)) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(LoadingActivity.this, LoginActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_in_upwards, R.anim.fade_out);
finish();
}
}, delay);
} // motorola done
else if (Build.MANUFACTURER.equals(oneplus)) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(LoadingActivity.this, LoginActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_in_upwards, R.anim.fade_out);
finish();
}
}, delay);
} //oneplus done
else if (Build.MANUFACTURER.equals(samsung)) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(LoadingActivity.this, LoginActivity.class);
startActivity(intent);
//overridePendingTransition(R.anim.slide_in_upwards, R.anim.fade_out);
finish();
}
}, delay);
} //Samsung done
else if (Build.MANUFACTURER.equals(Xiaomi)) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(LoadingActivity.this, LoginActivity.class);
startActivity(intent);
//overridePendingTransition(R.anim.slide_in_upwards, R.anim.fade_out);
finish();
}
}, delay);
} //Xiaomi done
else if (Build.MANUFACTURER.equals(VivoCaps)) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(LoadingActivity.this, LoginActivity.class);
startActivity(intent);
//overridePendingTransition(R.anim.slide_in_upwards, R.anim.fade_out);
finish();
}
}, delay);
} //Vivo done
else if (Build.MANUFACTURER.equals(oppo)) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(LoadingActivity.this, LoginActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_in_upwards, R.anim.fade_out);
finish();
}
}, delay);
} //oppo done
else {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(LoadingActivity.this, LoginActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_in_upwards, R.anim.fade_out);
finish();
}
}, delay);
} // rest Mobile Phones
}
}
XML activity_loading:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#000000">
<ImageView
android:layout_width="225sp"
android:layout_height="225sp"
android:src="@drawable/app_logo"
android:layout_gravity="center"
android:layout_marginTop="75sp"
android:layout_centerHorizontal="true"
android:contentDescription="App Logo"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="APPNAME"
android:gravity="center_horizontal"
android:fontFamily="@font/arial"
android:textColor="#CFCFCF"
android:textSize="30sp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="60sp"/>
</RelativeLayout>
我在切换活动时使用IF-ELSE是有原因的。 我希望少数品牌的手机可以参加其他活动,以后再编码。 目前,所有电话都重定向到“登录”。