skip to Main Content

I’ve created a new project in android studio but when I run the application to test it, it shows me this error:

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.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 8.0.2 is 33.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 34, then update this project to use
      compileSdk of at least 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).

I don’t know what is going on, but currently I’m using the latest updates and libraries.

These are dependencies:

dependencies {
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.10.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'com.github.bumptech.glide:glide:4.16.0'
    testImplementation 'junit:junit:4.13.2'

    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

This is the code:

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

import java.util.ArrayList;

public class AllBook extends AppCompatActivity {

    private RecyclerView bookRecView;
    BookRecAdapter bookAdapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_all_book);
        bookAdapter = new BookRecAdapter(this);
        bookRecView = findViewById(R.id.booksRecView);
        bookRecView.setAdapter(bookAdapter);
        bookRecView.setLayoutManager(new GridLayoutManager(this, 2));

        ArrayList<Book> books = new ArrayList<>();
        books.add(new Book(1, "1Q84", "Haruki Murakumi", 135, "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1483103331l/10357575.jpg", "1Q84 is a novel written by Japanese writer Haruki Murakami, first published in three volumes in Japan in 2009–10."
        , "1Q84 is a novel written by Japanese writer Haruki Murakami, first published in three volumes in Japan in 2009–10. It covers a fictionalized year of 1984 in parallel with a "real" one. The novel is a story of how a woman named Aomame begins to notice strange changes occurring in the world"));

        bookAdapter.setBooks(books);
    }
}

2

Answers


  1. replace this implemantation:
    implementation ‘com.google.android.material:material:1.10.0’
    with:
    implementation ‘com.google.android.material:material:1.8.0’

    Login or Signup to reply.
  2. If you visit the Maven repository page for material 1.10.0, you will notice a section called ‘Compile Dependencies.’ This section lists the dependencies required for the material dependency to compile and function properly. Typically, these compile dependencies are automatically included when you declare the main dependency in your project.

    The first dependency in the list is ‘activity 1.8.0,’ which is only compatible with ‘compileSdk’ versions greater than or equal to 34. To resolve this compatibility issue, you can either downgrade the material dependency or upgrade your project’s ‘compileSdk’ version.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search