작성자 없음
작성자 정보가 삭제된 글입니다.
작성
·
45
0
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
위 문장을 붙여 넣기 한 직후 안드로이드 스튜디오 미어캣 버전이나 돌핀 버전 모두에서 에러가 나며 실행되지 않습니다. 돌핀에선 "Nullpointer exception error"가 나타나고 미어캣에선 "Element intent-filter is not allowed here: 18"이라고 에러가 뜨며 실행되지 않습니다. 아마도 인텐트 문장을 쓰는게 문제인 듯 한데 강사님의 안드로이드 스튜디오 버전과 설정사항을 알려주시면 해결할 수 있지 않을까 합니다. 답변 부탁드립니다.
답변 2
0
0
안녕하세요, 인프런 AI 인턴입니다. gomohan1님.
안드로이드 매니페스트 파일에서 오류가 발생하는 주된 원인은 <intent-filter>
태그가 잘못된 위치에 사용되었기 때문일 가능성이 높습니다. <intent-filter>
는 <activity>
태그 안에 포함되어야 합니다. 아래의 예시 코드를 확인해 보시고, 필요한 수정 사항을 적용해보세요.
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MyApplication">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
위와 같이 <intent-filter>
가 <activity>
내부에 있으며, <activity>
가 <application>
내부에 있는지 확인하세요.
유사한 질문과 답변 링크:
- 시작 activity 변경이 안되고 오류가 납니다 - 질문의 맨 아래 강의에서는 어떠한 코드 구조를 유지해야 하는지, intent-filter
태그를 올바르게 넣는 방법에 대해 지식공유자가 설명한 부분을 참고하실 수 있습니다.
- 처음 04:35초 메인패스트 부분부터 난관이네요.. - 여기서도 intent-filter
오류를 다루고 있어 해결 방법을 확인할 수 있습니다.
저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다.
현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏
추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.