我在Android Studio中创建了一个新项目,但是当我运行应用程序进行测试时,它显示了以下错误:
我不知道发生了什么事,但目前我正在使用最新的更新和库。
这些是依赖项:
这是代码:
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).
我不知道发生了什么事,但目前我正在使用最新的更新和库。
这些是依赖项:
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'
}
这是代码:
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);
}
}