안드로이드 스튜디오 앱을 실행하면 keep stopping이 뜨네요 ㅜㅜ
조회수 5795회
MainActivity.java
package com.example.layout;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:gravity="center"
android:textSize="20dp"
android:layout_weight="1"
android:text="Timeline"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<TextView
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:gravity="center"
android:textSize="20dp"
android:layout_weight="1"
android:text="Untitle"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
</LinearLayout>
<view
android:layout_width="match_parent"
android:layout_height="5px"
android:background="#000000"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/item_post"/>
<include layout="@layout/item_post"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
item_post.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="400dp"
android:src="@drawable/ua2"
android:scaleType="centerCrop"
/>
<RelativeLayout
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:paddingRight="15dp"
android:paddingLeft="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_marginRight="15dp"
android:id="@+id/iv_like"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/heart"
android:scaleType="fitEnd"/>
<TextView
android:paddingTop="5dp"
android:textStyle="bold"
android:textSize="15dp"
android:layout_toRightOf="@id/iv_like"
android:layout_toLeftOf="@+id/iv_share"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:lines="1"
android:text="1323"/>
<ImageView
android:id="@+id/iv_share"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="200dp"
android:scaleType="centerCrop"
android:src="@drawable/share"/>
</RelativeLayout>
<view
android:layout_width="match_parent"
android:layout_height="3px"
android:background="#000000"/>
<RelativeLayout
android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textSize="18dp"
android:lines="1"
android:maxLength="10"
android:paddingLeft="14dp"
android:id="@+id/iv_kei"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="KeiUa_"/>
<TextView
android:lines="1"
android:layout_alignParentRight="true"
android:layout_marginLeft="25dp"
android:textSize="18dp"
android:layout_toRightOf="@id/iv_kei"
android:text="유아는 오늘도 이쁨 :)"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
</LinearLayout>
logcat
2020-01-21 22:13:13.027 7001-7001/? I/.example.layou: Not late-enabling -Xcheck:jni (already on)
2020-01-21 22:13:13.044 7001-7001/? E/.example.layou: Unknown bits set in runtime_flags: 0x8000
2020-01-21 22:13:13.045 7001-7001/? W/.example.layou: Unexpected CPU variant for X86 using defaults: x86
2020-01-21 22:13:13.427 7001-7037/com.example.layout D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
2020-01-21 22:13:13.427 7001-7037/com.example.layout W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied)
2020-01-21 22:13:13.420 7001-7001/com.example.layout W/RenderThread: type=1400 audit(0.0:38): avc: denied { write } for name="property_service" dev="tmpfs" ino=8396 scontext=u:r:untrusted_app:s0:c135,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=com.example.layout
2020-01-21 22:13:13.501 7001-7037/com.example.layout D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
2020-01-21 22:13:13.506 7001-7037/com.example.layout D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
2020-01-21 22:13:13.513 7001-7037/com.example.layout D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
2020-01-21 22:13:13.566 7001-7001/com.example.layout W/.example.layou: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2020-01-21 22:13:13.567 7001-7001/com.example.layout W/.example.layou: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2020-01-21 22:13:13.578 7001-7001/com.example.layout D/AndroidRuntime: Shutting down VM
2020-01-21 22:13:13.580 7001-7001/com.example.layout E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.layout, PID: 7001
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.layout/com.example.layout.MainActivity}: android.view.InflateException: Binary XML file line #42 in com.example.layout:layout/activity_main: Binary XML file line #42 in com.example.layout:layout/activity_main: Error inflating class null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: android.view.InflateException: Binary XML file line #42 in com.example.layout:layout/activity_main: Binary XML file line #42 in com.example.layout:layout/activity_main: Error inflating class null
Caused by: android.view.InflateException: Binary XML file line #42 in com.example.layout:layout/activity_main: Error inflating class null
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1054)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:997)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.example.layout.MainActivity.onCreate(MainActivity.java:12)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
1 답변
-
사실 저는 안드로이드를 안해봤습니다만...
2020-01-21 22:13:13.580 7001-7001/com.example.layout E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.layout, PID: 7001 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.layout/com.example.layout.MainActivity}: android.view.InflateException: Binary XML file line #42 in com.example.layout:layout/activity_main: Binary XML file line #42 in com.example.layout:layout/activity_main: Error inflating class null at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
에러 로그와 "Error inflating class null" 검색 결과를 보니
activity_main.xml 파일 42번 째 줄
<view
를<View
로 바꿔보라는 결론이 나오네요.이걸로 해결이 안되면 item_post.xml 파일의
<view
도 바꿔보세요.
댓글 입력