在牛轧糖以下的 OS 版本上获得 运行 时间异常
getting a Run time Exception on OS versions below Nougat
我的应用程序在 android 7 版本 phone 下崩溃了。
这是我的应用程序 https://play.google.com/store/apps/details?id=comdhanusharea.wixsite.benitinhere.phonebook 的 link。
我不知道为什么会崩溃 report.When 我尝试在以下 android 版本 7 phone 应用程序安装我的应用程序崩溃并告诉我
Unfortunately,Application is stopped
我在我的开发者帐户上收到了这份崩溃报告。
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2338)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2390)
at android.app.ActivityThread.access0 (ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1321)
at android.os.Handler.dispatchMessage (Handler.java:110)
at android.os.Looper.loop (Looper.java:193)
at android.app.ActivityThread.main (ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative (Native Method)
at java.lang.reflect.Method.invoke (Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:640)
at dalvik.system.NativeStart.main (Native Method)
Caused by: android.view.InflateException:
at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:758)
at android.view.LayoutInflater.inflate (LayoutInflater.java:492)
at android.view.LayoutInflater.inflate (LayoutInflater.java:397)
at android.view.LayoutInflater.inflate (LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView (AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView (AppCompatActivity.java:139)
at comdhanusharea.wixsite.benitinhere.phonebook.A2_Login.onCreate (A2_Login.java:36)
at android.app.Activity.performCreate (Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2302)
Caused by: android.content.res.Resources$NotFoundException:
at android.content.res.Resources.loadDrawable (Resources.java:2124)
at android.content.res.TypedArray.getDrawable (TypedArray.java:602)
at android.widget.ImageView.<init> (ImageView.java:129)
at android.support.v7.widget.AppCompatImageView.<init> (AppCompatImageView.java:72)
at android.support.v7.widget.AppCompatImageView.<init> (AppCompatImageView.java:68)
at android.support.v7.app.AppCompatViewInflater.createView (AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImplV9.createView (AppCompatDelegateImplV9.java:1024)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView (AppCompatDelegateImplV9.java:1081)
at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:684)
这是我的Java onCreate 函数A2_Login代码
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_a2__login);
SharedPreferences preferences=getSharedPreferences("PhoneBook",MODE_PRIVATE);
Boolean b= preferences.getBoolean("IsLogin",false);
if(b)
{
startActivity(new Intent(this,A3_HomePage.class));
finish();
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
if (ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.WRITE_CONTACTS) != PackageManager.PERMISSION_GRANTED
)
{
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.READ_CONTACTS}, REQUEST_PHONE_CALL);
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.WRITE_CONTACTS}, REQUEST_PHONE_CALL);
}
if( ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.INTERNET}, REQUEST_PHONE_CALL);
}
}
else{
if (ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.WRITE_CONTACTS) != PackageManager.PERMISSION_GRANTED
)
{
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.READ_CONTACTS}, REQUEST_PHONE_CALL);
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.WRITE_CONTACTS}, REQUEST_PHONE_CALL);
}
if( ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.INTERNET}, REQUEST_PHONE_CALL);
}
}
db = openOrCreateDatabase("db_contactmanager", MODE_PRIVATE, null);
db.execSQL("Create Table If Not Exists tbl_register(" +
"db_regiser_id Integer Primary Key AutoIncrement," +
"db_gender nvarchar(20)," +
"db_fname nvarchar(20)," +
"db_lname nvarchar(20)," +
"db_mobile nvarchar(13)," +
"db_mail nvarchar(50)," +
"db_passwd nvarchar(15))");
db.execSQL("Create Table If Not Exists tbl_root1(" +
"db_security nvarchar(50) not null," +
"db_fname nvarchar(20)," +
"db_lname nvarchar(20)," +
"db_mobile nvarchar(13)," +
"db_mail nvarchar(50)," +
"db_passwd nvarchar(15))");
edt_phone_mail = (EditText) findViewById(R.id.A2_edt_phone_mail);
edit_passwd = (EditText) findViewById(R.id.A2_edt_passwd);
}
这是我的布局文件
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back2"
android:orientation="vertical"
tools:context="comdhanusharea.wixsite.benitinhere.phonebook.A2_Login">
<TextView
android:id="@+id/A2_r_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:layout_marginTop="30dp"
android:layout_weight="1.5"
android:fontFamily="cursive"
android:gravity="center"
android:text="Sign In"
android:textColor="@color/md_black_1000"
android:textSize="50dp"
android:textStyle="bold" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/A2_r_txt">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/A2_r_ll1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/A2_r_txt"
android:layout_weight="1">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="8dp"
android:layout_weight=".5"
android:backgroundTint="@color/colorPrimary"
android:src="@drawable/username" />
<EditText
android:id="@+id/A2_edt_phone_mail"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="4.6"
android:backgroundTint="@color/colorPrimary"
android:ems="10"
android:hint="Enter Email id or Phone number"
android:inputType="text"
android:padding="20dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/A2_r_ll2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/A2_r_ll1"
android:layout_weight="1">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="8dp"
android:layout_weight=".5"
android:src="@drawable/password" />
<EditText
android:id="@+id/A2_edt_passwd"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="4.6"
android:ems="10"
android:hint="Enter Password"
android:inputType="textPassword"
android:padding="20dp" />
</LinearLayout>
<Button
android:id="@+id/A2_r_btn_signup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/A2_r_ll2"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:layout_weight=".8"
android:background="@drawable/btn_background"
android:onClick="fun_A2_btnlogin"
android:text="Login" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/A2_r_btn_signup"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginBottom="100dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:onClick="fun_A2_btnsignup"
android:text="I don't have an account"
android:textColor="@color/md_black_1000"
android:textSize="20dp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
jelly bean 中支持的最低 android 版本
我的问题与 Unfortunately MyApp has stopped. How can I solve this? 不重复
我的问题与此不同,因为在编译我的项目时,我没有遇到任何类型的崩溃或错误。
提前致谢。
我认为你的图像在 drawable-v24 或其他文件夹中将它移动到 drawable 文件夹并再次测试。
我的应用程序在 android 7 版本 phone 下崩溃了。 这是我的应用程序 https://play.google.com/store/apps/details?id=comdhanusharea.wixsite.benitinhere.phonebook 的 link。
我不知道为什么会崩溃 report.When 我尝试在以下 android 版本 7 phone 应用程序安装我的应用程序崩溃并告诉我
Unfortunately,Application is stopped
我在我的开发者帐户上收到了这份崩溃报告。
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2338)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2390)
at android.app.ActivityThread.access0 (ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1321)
at android.os.Handler.dispatchMessage (Handler.java:110)
at android.os.Looper.loop (Looper.java:193)
at android.app.ActivityThread.main (ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative (Native Method)
at java.lang.reflect.Method.invoke (Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:640)
at dalvik.system.NativeStart.main (Native Method)
Caused by: android.view.InflateException:
at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:758)
at android.view.LayoutInflater.inflate (LayoutInflater.java:492)
at android.view.LayoutInflater.inflate (LayoutInflater.java:397)
at android.view.LayoutInflater.inflate (LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView (AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView (AppCompatActivity.java:139)
at comdhanusharea.wixsite.benitinhere.phonebook.A2_Login.onCreate (A2_Login.java:36)
at android.app.Activity.performCreate (Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2302)
Caused by: android.content.res.Resources$NotFoundException:
at android.content.res.Resources.loadDrawable (Resources.java:2124)
at android.content.res.TypedArray.getDrawable (TypedArray.java:602)
at android.widget.ImageView.<init> (ImageView.java:129)
at android.support.v7.widget.AppCompatImageView.<init> (AppCompatImageView.java:72)
at android.support.v7.widget.AppCompatImageView.<init> (AppCompatImageView.java:68)
at android.support.v7.app.AppCompatViewInflater.createView (AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImplV9.createView (AppCompatDelegateImplV9.java:1024)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView (AppCompatDelegateImplV9.java:1081)
at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:684)
这是我的Java onCreate 函数A2_Login代码
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_a2__login);
SharedPreferences preferences=getSharedPreferences("PhoneBook",MODE_PRIVATE);
Boolean b= preferences.getBoolean("IsLogin",false);
if(b)
{
startActivity(new Intent(this,A3_HomePage.class));
finish();
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
if (ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.WRITE_CONTACTS) != PackageManager.PERMISSION_GRANTED
)
{
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.READ_CONTACTS}, REQUEST_PHONE_CALL);
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.WRITE_CONTACTS}, REQUEST_PHONE_CALL);
}
if( ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.INTERNET}, REQUEST_PHONE_CALL);
}
}
else{
if (ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.WRITE_CONTACTS) != PackageManager.PERMISSION_GRANTED
)
{
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.READ_CONTACTS}, REQUEST_PHONE_CALL);
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.WRITE_CONTACTS}, REQUEST_PHONE_CALL);
}
if( ContextCompat.checkSelfPermission(A2_Login.this, Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(A2_Login.this, new String[]{Manifest.permission.INTERNET}, REQUEST_PHONE_CALL);
}
}
db = openOrCreateDatabase("db_contactmanager", MODE_PRIVATE, null);
db.execSQL("Create Table If Not Exists tbl_register(" +
"db_regiser_id Integer Primary Key AutoIncrement," +
"db_gender nvarchar(20)," +
"db_fname nvarchar(20)," +
"db_lname nvarchar(20)," +
"db_mobile nvarchar(13)," +
"db_mail nvarchar(50)," +
"db_passwd nvarchar(15))");
db.execSQL("Create Table If Not Exists tbl_root1(" +
"db_security nvarchar(50) not null," +
"db_fname nvarchar(20)," +
"db_lname nvarchar(20)," +
"db_mobile nvarchar(13)," +
"db_mail nvarchar(50)," +
"db_passwd nvarchar(15))");
edt_phone_mail = (EditText) findViewById(R.id.A2_edt_phone_mail);
edit_passwd = (EditText) findViewById(R.id.A2_edt_passwd);
}
这是我的布局文件
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back2"
android:orientation="vertical"
tools:context="comdhanusharea.wixsite.benitinhere.phonebook.A2_Login">
<TextView
android:id="@+id/A2_r_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:layout_marginTop="30dp"
android:layout_weight="1.5"
android:fontFamily="cursive"
android:gravity="center"
android:text="Sign In"
android:textColor="@color/md_black_1000"
android:textSize="50dp"
android:textStyle="bold" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/A2_r_txt">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/A2_r_ll1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/A2_r_txt"
android:layout_weight="1">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="8dp"
android:layout_weight=".5"
android:backgroundTint="@color/colorPrimary"
android:src="@drawable/username" />
<EditText
android:id="@+id/A2_edt_phone_mail"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="4.6"
android:backgroundTint="@color/colorPrimary"
android:ems="10"
android:hint="Enter Email id or Phone number"
android:inputType="text"
android:padding="20dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/A2_r_ll2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/A2_r_ll1"
android:layout_weight="1">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="8dp"
android:layout_weight=".5"
android:src="@drawable/password" />
<EditText
android:id="@+id/A2_edt_passwd"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="4.6"
android:ems="10"
android:hint="Enter Password"
android:inputType="textPassword"
android:padding="20dp" />
</LinearLayout>
<Button
android:id="@+id/A2_r_btn_signup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/A2_r_ll2"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:layout_weight=".8"
android:background="@drawable/btn_background"
android:onClick="fun_A2_btnlogin"
android:text="Login" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/A2_r_btn_signup"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginBottom="100dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:onClick="fun_A2_btnsignup"
android:text="I don't have an account"
android:textColor="@color/md_black_1000"
android:textSize="20dp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
jelly bean 中支持的最低 android 版本
我的问题与 Unfortunately MyApp has stopped. How can I solve this? 不重复 我的问题与此不同,因为在编译我的项目时,我没有遇到任何类型的崩溃或错误。
提前致谢。
我认为你的图像在 drawable-v24 或其他文件夹中将它移动到 drawable 文件夹并再次测试。