빈 활동 만 만들었고 앱이 계속 충돌합니다. logcat은 몇 가지 치명적인 예외를 보여줍니다.

스테파니 -JK

나는 안드로이드 개발에서 일종의 새로운 것입니다. 내 앱이 계속 충돌하는 이유를 모르겠지만 gradle에는 오류가 표시되지 않지만 logcat에는 많은 예외가 있습니다. 그리고 솔직히 저는 logcat 세부 사항의 대부분을 이해하지 못합니다.

내 앱이 충돌하지 않도록하려면 어떻게합니까? 그리고 그것이 충돌하는 원인은 무엇입니까? 다음은 logcat 세부 정보입니다.

10-25 11:56:32.870 3126-3126/? I/art: Not late-enabling -Xcheck:jni (already on)
10-25 11:56:32.870 3126-3126/? I/art: Late-enabling JIT
10-25 11:56:32.896 3126-3126/? I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
10-25 11:56:33.050 3126-3133/? I/art: Debugger is no longer active
10-25 11:56:33.372 3126-3126/? W/System: ClassLoader referenced unknown path: /data/app/com.example.subinasharma.myapplication-2/lib/x86
10-25 11:56:35.029 3126-3133/com.example.subinasharma.myapplication W/art: Suspending all threads took: 15.151ms
10-25 11:56:35.071 3126-3126/com.example.subinasharma.myapplication D/AndroidRuntime: Shutting down VM
10-25 11:56:35.075 3126-3126/com.example.subinasharma.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                      Process: com.example.subinasharma.myapplication, PID: 3126
                                                                                      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.subinasharma.myapplication/com.example.subinasharma.myapplication.MainActivity}: android.view.InflateException: Binary XML file line #15: Failed to resolve attribute at index 6: TypedValue{t=0x1d/d=0xff3f51b5 a=2 r=0x7f0b0013}
                                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                                          at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                          at android.os.Looper.loop(Looper.java:148)
                                                                                          at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                                       Caused by: android.view.InflateException: Binary XML file line #15: Failed to resolve attribute at index 6: TypedValue{t=0x1d/d=0xff3f51b5 a=2 r=0x7f0b0013}
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                                          at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
                                                                                          at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
                                                                                          at com.example.subinasharma.myapplication.MainActivity.onCreate(MainActivity.java:17)
                                                                                          at android.app.Activity.performCreate(Activity.java:6237)
                                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                          at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                          at android.os.Looper.loop(Looper.java:148) 
                                                                                          at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                          at java.lang.reflect.Method.invoke(Native Method) 
                                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                                       Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x1d/d=0xff3f51b5 a=2 r=0x7f0b0013}
                                                                                          at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:705)
                                                                                          at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:6890)
                                                                                          at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:7071)
                                                                                          at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1911)
                                                                                          at android.support.design.widget.AppBarLayout$LayoutParams.<init>(AppBarLayout.java:554)
                                                                                          at android.support.design.widget.AppBarLayout.generateLayoutParams(AppBarLayout.java:284)
                                                                                          at android.support.design.widget.AppBarLayout.generateLayoutParams(AppBarLayout.java:97)
                                                                                          at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
                                                                                          at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                                                          at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
                                                                                          at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                                                          at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                                                          at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256) 
                                                                                          at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
                                                                                          at com.example.subinasharma.myapplication.MainActivity.onCreate(MainActivity.java:17) 
                                                                                          at android.app.Activity.performCreate(Activity.java:6237) 
                                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                          at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                          at android.os.Looper.loop(Looper.java:148) 
                                                                                          at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                          at java.lang.reflect.Method.invoke(Native Method) 
                                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
10-25 11:56:35.883 3126-3133/com.example.subinasharma.myapplication W/art: Suspending all threads took: 35.182ms
10-25 11:56:43.252 3126-3126/com.example.subinasharma.myapplication I/Process: Sending signal. PID: 3126 SIG: 9

Android Studio 자체에서 생성 된 두 가지 레이아웃 인 Activity_Main.xml이 있습니다.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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.subinasharma.myapplication.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_main" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_email" />

</android.support.design.widget.CoordinatorLayout>

및 다른 Content_Main.xml :

<?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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.example.subinasharma.myapplication.MainActivity"
    tools:showIn="@layout/activity_main">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!" />
</RelativeLayout>

Gradle 파일 :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.example.subinasharma.myapplication2"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
}
딜립 파텔

@ Stephanie-JK 새 프로젝트를 만들 때 BASE 활동을 선택 했으므로이 문제가 발생한다고 생각합니다. 다음에 새 프로젝트를 만들 때 빈 활동을 선택한 다음 하나의 레이아웃 만 생성하면 문제가 해결됩니다. 감사합니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관