gpt4 book ai didi

android - 在牛轧糖以下的操作系统版本上获得运行时异常

转载 作者:行者123 更新时间:2023-11-29 19:00:21 25 4
gpt4 key购买 nike

我的应用程序在 android 7 版本以下的手机上崩溃了。这是我申请的链接 https://play.google.com/store/apps/details?id=comdhanusharea.wixsite.benitinhere.phonebook .

我不知道为什么我会收到此崩溃报告。当我尝试在低于 Android 版本 7 的手机应用程序中安装我的应用程序时崩溃并向我展示

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.access$800 (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)

这是我的 A2_Login onCreate 函数的 Java 代码

@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 - 在牛轧糖以下的操作系统版本上获得运行时异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49229989/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com