>

앱을 휴대 전화에 배포하는 동안 앱이 중지되었다는 메시지와 함께 앱이 계속 중단됩니다. 이미 스택 오버플로에 대한 답변을 찾으려고 시도했지만 아무것도 문제를 해결하지 못합니다. 나는 대답 중 하나가 말했듯이 프로젝트를 정리하고 무효화하고 다시 시작하며 Api를 28에서 27로 변경했습니다. 내가 찾은 모든 것을 시도했습니다.

MainActivity.java

package com.example.panchaat;
 import android.content.Intent;
 import android.os.Bundle;
 import androidx.appcompat.widget.Toolbar;
 import android.view.MenuItem;
 import android.view.View;
 import android.widget.*;
 import androidx.annotation.NonNull;
 import androidx.appcompat.app.ActionBarDrawerToggle;
 import androidx.appcompat.app.AppCompatActivity;
 import androidx.drawerlayout.widget.DrawerLayout;
 import androidx.recyclerview.widget.RecyclerView;
 import com.google.android.material.navigation.NavigationView;
 import com.google.firebase.auth.FirebaseAuth;
 import com.google.firebase.auth.FirebaseUser;
 public class MainActivity extends AppCompatActivity {
    private NavigationView navigationView;
    private ActionBarDrawerToggle actionBarDrawerToggle;
    private DrawerLayout drawerLayout;
    private RecyclerView postList;
    private Toolbar mToolbar;
    private FirebaseAuth mAuth;
 @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
                      }
                     }

build.gradle

     apply plugin: 'com.android.application'
 android {
 compileSdkVersion 28
 defaultConfig {
    applicationId "com.example.panchaat"
    minSdkVersion 19
    targetSdkVersion 28
    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'
      }
  }
  compileOptions {
       targetCompatibility = '1.8'
       sourceCompatibility = '1.8'
  }
   buildToolsVersion = '28.0.3'
 }
 dependencies {
   implementation fileTree(dir: 'libs', include: ['*.jar'])
   implementation 'com.android.support:appcompat-v7:28.1.1'
   implementation 'com.android.support:design:28.1.0'
   implementation 'com.android.support.constraint:constraint-layout:1.1.2'
   implementation 'com.google.firebase:firebase-auth:11.0.2'
   implementation 'com.google.android.gms:play-services-auth:11.0.2'
   implementation 'com.google.firebase:firebase-database:11.0.2'
   implementation 'com.google.firebase:firebase-storage:11.0.2'
   implementation 'de.hdodenhof:circleimageview:3.0.0'
   implementation 'com.theartofdev.edmodo:android-image-cropper:+'
   implementation 'com.squareup.picasso:picasso:2.5.2'
   implementation 'com.firebaseui:firebase-ui-database:2.1.1'
   implementation 'androidx.appcompat:appcompat:1.0.2'
   implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
   implementation 'com.android.support:appcompat-v7:28.1.1'
   implementation 'com.android.support:design:28.1.1'
   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'
   implementation 'com.android.support:support-v13:28.0.0'
   implementation files('support-v13')
   implementation 'com.android.support:support-v4:28.0.0'
   implementation 'com.android.support:support-v13:28.0.0'
   implementation "com.android.support:support-core-utils:28.1.0"
   }
   apply plugin: 'com.google.gms.google-services'

activity_main.xml :

<?xml version="1.0" encoding="utf-8"?>
 <androidx.drawerlayout.widget.DrawerLayout
    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:fitsSystemWindows ="true"
    tools:context="com.example.panchaat.MainActivity"
    android:id="@+id/drawer_layout">
<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
   <include
   android:id="@+id/main_page_toolbar"
    layout="@layout/app_bar_layout">
   </include>

    <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="634dp"
            android:layout_alignParentStart="true"
            android:layout_marginStart="0dp"
            android:layout_alignParentTop="true"
            android:layout_marginTop="21dp"
            android:id="@+id/main_contaier">
        <androidx.recyclerview.widget.RecyclerView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/all_users_post_list"
                android:layout_alignTop="@+id/main_contaier"
                android:layout_alignStart="@+id/main_contaier"/>
    </FrameLayout>
</RelativeLayout>
<com.google.android.material.navigation.NavigationView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:layout_marginBottom="3dp"
        app:menu="@menu/navigation_menu"
        android:id="@+id/navigation_view">
 </com.google.android.material.navigation.NavigationView>
 </androidx.drawerlayout.widget.DrawerLayout>

app_bar_layout.xml :

<androidx.appcompat.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
     android:id ="@+id/main_app_bar"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:background ="#3a1c71"
    android:theme ="@style/ThemeOverlay.AppCompat.Dark">
  </androidx.appcompat.widget.Toolbar>

로그 캣

Caused by: android.view.InflateException: Binary XML file line #2: Binary 
 XML file line #2: Error inflating class 
 android.support.v4.widget.DrawerLayout
 Caused by: android.view.InflateException: Binary XML file line #2: Error 
 inflating class android.support.v4.widget.DrawerLayout
 Caused by: java.lang.ClassNotFoundException: Didn't find class 
 "android.support.v4.widget.DrawerLayout"

  • 답변 # 1

    와이즈 비즈 와이즈 비즈

    에서Android 지원 라이브러리와 AndroidX를 혼합하기 때문입니다.
    :

    Caused by: android.view.InflateException: Binary XML file line #2: Binary 
     XML file line #2: Error inflating class 
     android.support.v4.widget.DrawerLayout
     Caused by: android.view.InflateException: Binary XML file line #2: Error 
     inflating class android.support.v4.widget.DrawerLayout
     Caused by: java.lang.ClassNotFoundException: Didn't find class 
     "android.support.v4.widget.DrawerLayout"
    
    

    activity_main.xml
    
    

    그리고 의존성에서 지원 라이브러리를 사용하지 않은 것 같습니다. 따라서 오류가 발생합니다.

    AndroidX보기를 사용하도록 레이아웃을 변경하십시오.

    당신의 <?xml version="1.0" encoding="utf-8"?> <!-- This is Android Support Library --> <android.support.v4.widget.DrawerLayout ... android:id="@+id/drawable_layout"> ... <!-- This is AndroidX library --> <com.google.android.material.navigation.NavigationView android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:layout_marginBottom="3dp" app:menu="@menu/navigation_menu" android:id="@+id/navigation_view"> 에 대한

    , 이런 식으로 :

    </android.support.v4.widget.DrawerLayout>
    
    

    와 당신의 activity_main.xml :

    <?xml version="1.0" encoding="utf-8"?>
     <androidx.drawerlayout.widget.DrawerLayout
        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"
        tools:context="com.example.panchaat.MainActivity"
        android:id="@+id/drawable_layout">
         ...
       <com.google.android.material.navigation.NavigationView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:layout_marginBottom="3dp"
            app:menu="@menu/navigation_menu"
            android:id="@+id/navigation_view">
      </com.google.android.material.navigation.NavigationView>
    </androidx.drawerlayout.widget.DrawerLayout>
    
    

    또한 app_bar_layout.xml 에서 올바른 해당보기를 가져와야합니다. .

    AndroidX로 마이그레이션을 방문하십시오

    <?xml version="1.0" encoding="utf-8"?> <androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id ="@+id/main_app_bar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background ="#3a1c71" android:theme ="@style/ThemeOverlay.AppCompat.Light"> </androidx.appcompat.widget.Toolbar>

관련 자료

  • 이전 javascript - 인형 - pageevaluate (() => documentqueryselectorall ())을 사용하여 특정 웹 사이트에서 요소를 추출 할 수 없습니다
  • 다음 SQL에서 group by의 기본 기능은 무엇입니까?