我的项目工作得非常好,但直到有一天,我将项目上传到github.我不知道这个问题是否与此有关,但今天当我编译我的android studio项目时,它开始向我展示这4个可怕的错误.我已经尝试了大部分谷歌搜索结果但没有帮助!
错误:无法解决:com.android.support:cardview-v7:25.0.0
错误:无法解决:com.android.support:customtabs:25.0.0
错误:无法解决:com.android.support:appcompat- v7:25.0.0
错误:无法解决:com.android.support :support-v4:25.0.0
这是android studio屏幕的屏幕截图,如果它有帮助!
这是我的应用级build.gradle文件:
apply plugin: 'com.android.application'
repositories {
mavenLocal()
mavenCentral()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.google.firebase.codelab.friendlychat"
minSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12' …Run Code Online (Sandbox Code Playgroud) android android-support-library android-gradle-plugin android-api-levels
我使用下面添加的代码来获取Android设备的连接音频设备.使用AudioManager api方法,getDevices()并通过耳机,扬声器,耳机等连接设备获得结果.但是这个getDevices()方法仅在android api level 23(Marshmallow)之后可用.
但是我的应用程序应该支持api level 21(Lollipop).请任何人都可以告诉我替代api获取Android设备的可用音频设备.
与api级别23一起使用的代码.
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
AudioDeviceInfo[] adi = audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
}
Run Code Online (Sandbox Code Playgroud)
请帮助我为Marshmallow(api level 23)下的Android OS版本运行的设备提供连接的音频设备.
android android-hardware android-audiomanager android-5.0-lollipop android-api-levels
谷歌最近宣布他们将开始限制发布不针对最新API级别版本的Android应用程序.我支持这种更改,但我需要一些特殊情况例外,并且没有找到合适的论坛来请求这些.我知道这不是它,但希望有人能指出我应该去的地方.
我发布了一个已经存在很长时间的应用程序,并且仍有大量用户在Gingerbread下运行它.它还使用了许多支持库,这些库的最新版本(针对最新API级别的库)不再支持Gingerbread设备.最终结果是我无法构建和支持API级别9的apk,如果它针对的是大于23的SDK级别.这将是11月份不会被接受的.
我确实有计划解决这个问题.那是为每次更新开始分发两个apk文件.一个针对最新的API级别并且具有大约21的最小API.另一个将支持旧设备,并且目标和最大API为20,最小API为9.问题是较旧的目标API apk不会被Play商店接受,除非我能说服某人他们应该继续接受任何目标和最高API级别相同的应用.
在android Java上工作,最近将SDK更新到API级别29,现在显示警告,指出
Environment.getExternalStorageDirectory() 在API级别29中已弃用
我的代码是
private void saveImage() {
if (requestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
final String folderPath = Environment.getExternalStorageDirectory() + "/PhotoEditors";
File folder = new File(folderPath);
if (!folder.exists()) {
File wallpaperDirectory = new File(folderPath);
wallpaperDirectory.mkdirs();
}
showLoading("Saving...");
final String filepath=folderPath
+ File.separator + ""
+ System.currentTimeMillis() + ".png";
File file = new File(filepath);
try {
file.createNewFile();
SaveSettings saveSettings = new SaveSettings.Builder()
.setClearViewsEnabled(true)
.setTransparencyEnabled(true)
.build();
if(isStoragePermissionGranted() ) {
mPhotoEditor.saveAsFile(file.getAbsolutePath(), saveSettings, new PhotoEditor.OnSaveListener() {
@Override
public void onSuccess(@NonNull String imagePath) {
hideLoading();
showSnackbar("Image Saved …Run Code Online (Sandbox Code Playgroud) I have a DialogFragment that handles login and fingerprint authentication for my application. This fragment uses two classes that are exclusive to API 23, KeyGenParameterSpec and KeyPermanentlyInvalidatedException. I had been under the impression that I could use these classes, as long as I check the build version before I try to initialize the classes (outlined here):
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
...
} else {
...
}
Run Code Online (Sandbox Code Playgroud)
But it appears that this is not the case. If I try …
android dalvik android-version android-api-levels android-fingerprint-api
我的应用程序的最低API级别是19(KitKat),并包含一个水平布局ProgressBar.我正在使用android:progressTint属性将条形色调为自定义颜色.它在Lollipop(API 21)及更高版本上运行良好,但在下面(例如在API 19上)它没有; 它以不同的颜色显示出来.原因是这个属性
仅用于API级别21及更高级别
正如Android Studio所述.
所以我想知道什么是一个很好的替代方案,也可以用来ProgressBar点亮前Lollipop设备.可以使用XML在布局文件中创建吗?或者应该以不同的方式完成?
编辑#1:我的ProgressBar用于显示百分比的具体值,而不是用于指示我的布局正在加载.我想明确这一点,因为在尝试了Kuldeep Kulkarni在下面写的内容之后,我的酒吧看起来像一个材料加载指示器(当然在Lollipop设备上,而不是KitKat设备上的任何可见结果).
android android-layout android-progressbar android-api-levels
Google允许我们使用Android标准库在旧版API上提供最新功能.Google鼓励使用此工具集,但未提及其缺点.
是否有更高的RAM或CPU使用率,更慢的渲染或类似?为什么不将每个新功能作为库的一部分添加而不是维护2个单独的版本?我看到的几乎每个示例和现实代码都必须使用这个库来支持ActionBar和其他东西,所以我们可以假设90 +%的应用程序依赖它.为什么不强行呢?
我上传了一个新的beta测试版本,其Android目标api级别为23.在22之前我不知道,对于API级别23,有许多关于权限的更改.我意识到在使用api级别23上传新的beta测试版本之后.所以我构建了一个新的版本,它再次使用api level 22来有更多的时间来使我的应用程序适应api level 23.
但每次现在当我上传一个api级别为22的版本时,我在开发者控制台中出现错误"app无法保存",没有关于错误的更多信息,我无法上传它.当我编译具有目标API级别23的新版本时,可以再次上载.我认为问题是降级到api 22级.
是否属实,一旦您在封闭式Beta版测试中发布API Level 23版本,您就无法降级回目标API级别22?
谢谢你的帮助!
Smilingm
android android-permissions android-6.0-marshmallow android-api-levels
我使用 API 33 创建了一个新项目,但找不到某些字段。同时API 32也发现它没有问题。当我用 . 打开它时它会发出警告API 33。
buid.gradle(My Application):
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
build.gradle(:app):
android {
compileSdk 33
defaultConfig {
applicationId "com.halil.ozel.myapplication"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility …Run Code Online (Sandbox Code Playgroud) 将我的应用程序上传到 Google 时出现以下错误:
Your app currently targets API level 30 and must target at least API level 31 to ensure it is built on the latest APIs optimized for security and performance. Change your app's target API level to at least 31.
Run Code Online (Sandbox Code Playgroud)
这是我的android/build.gradle:
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
...
}
Run Code Online (Sandbox Code Playgroud)
如何将应用程序目标 API 升级到级别 31?