마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

안드로이드스튜디오 에뮬레이터 실행 오류

0 추천
토스트 메시지 코드를 넣어도 virtual device에서는 안 떠서 wipe data를 눌렀더니 이제 에뮬레이터 자체가 실행이 안됩니다...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > An issue was found when checking AAR metadata:
     
       1.  Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that
           depend on it to compile against version 34 or later of the
           Android APIs.
     
           :app is currently compiled against android-33.
     
           Recommended action: Update this project to use a newer compileSdk
           of at least 34, for example 34.
     
           Note that updating a library or application's compileSdk (which
           allows newer APIs to be used) can be done separately from updating
           targetSdk (which opts the app in to new runtime behavior) and
           minSdk (which determines which devices the app can be installed
           on).

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

 

실행 누르면 build에 이런 메시지가 여러개 뜹니다. 영상 보고 따라한거라 코드는 똑같은데 왜 이렇게 된건가요?
spgg (210 포인트) 님이 2023년 10월 10일 질문
package techtown.org;

import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void onButton1Clicked(View v) {
        Toast.makeText(getApplicationContext(), "버튼이 눌렸어요.", Toast.LENGTH_SHORT).show();
    }

}
코드는 이렇습니다

1개의 답변

+1 추천
 
채택된 답변

androidx.activity:activity:1.8.0 에서 사용되는 sdk 버전이 34 이상인데

프로젝트에서 사용 중이신 sdk 버전이 33이셔서 충돌나는 문제입니다.

androidx.activity:activity 버전을 낮추시던지

프로젝트 sdk 버전을 올리시던지 하셔야 합니다.

근데 34면 Android 14니까 너무 높으니 androidx.activity:activity 버전을 낮추시는게 좋을 것 같습니다.

1.7.0 정도로 낮추시면 될겁니다.

JeepChief (460 포인트) 님이 2023년 10월 11일 답변
spgg님이 2023년 10월 11일 채택됨
감사합니다! 시도해보겠습니다
...