大佬教程收集整理的这篇文章主要介绍了为什么我的应用程序能够在较新的设备上运行,但不能在较旧的设备上运行(向后兼容性 build.gradle 问题)?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在开发一个 AndroID 应用程序,其中使用了 JsonObjectrequest
和 AndroID 的 Volley。
我的应用程序似乎在 AndroID 的 Pixel XL API 30 上运行得非常好(打印出所需的输出),但不适用于 AndroID 的 Pixel 2 API 29,即使我在 {{ 中定义了 @H_47_3@minSdkVersion 16 1}}
这是我的build.gradle
:
build.gradle
这是我的plugins {
ID 'com.androID.application'
}
androID {
compileSdkVersion 30
buildToolsversion "30.0.2"
defaultConfig {
applicationID "com.krish.parsedata"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionname "1.0"
testinstrumentationRunner "androIDx.test.runner.AndroIDJUnitRunner"
}
buildTypes {
release {
MinifyEnabled false
proguardfiles getDefaultProguardfile('proguard-androID-optimize.txt'),'proguard-rules.pro'
}
}
compiLeoptions {
@R_675_9016@eCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencIEs {
implementation 'androIDx.appcompat:appcompat:1.2.0'
implementation 'com.Google.androID.material:material:1.3.0'
implementation 'androIDx.consTraintlayout:consTraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androIDTestImplementation 'androIDx.test.ext:junit:1.1.2'
androIDTestImplementation 'androIDx.test.espresso:espresso-core:3.3.0'
implementation 'com.androID.volley:volley:1.2.0'
}
:
@H_47_3@mainActivity.java
谢谢!
更新:这一直显示:
public class MainActivity extends AppCompatActivity {
requestQueue queue;
String url = "https://www.Google.com";
String APIUrl = "https://Jsonplaceholder.typicode.com/todos";
String getAPIUrl = "https://Jsonplaceholder.typicode.com/todos/1";
@OverrIDe
protected voID onCreate(Bundle savedInstanceStatE) {
super.onCreate(savedInstanceStatE);
setContentVIEw(R.layout.activity_main);
queue = Volley.newrequestQueue(this);
JsonObjectrequest JsonObjectrequest = new JsonObjectrequest(request.Method.GET,getAPIUrl,null,new Response.Listener<JsONObject>() {
@OverrIDe
public voID onResponse(JsONObject responsE) {
try {
Log.d("url","onCreate: " + response.getString("title"));
} catch (JsONException E) {
e.printstacktrace();
}
}
},new Response.ErrorListener() {
@OverrIDe
public voID onErrorResponse(VolleyError error) {
Log.d("url2","There was an error");
}
});
queue.add(JsonObjectrequest);
}
}
清单:
AndroID studio is using the following JDK LOCATIOn when running Gradle:
/Applications/AndroID studio.app/Contents/jre/jdk/Contents/Home
Using different JDK LOCATIOns on different processes might cause Gradle to
spawn multiple daemons,for example,by execuTing Gradle tasks from a terminal
while using AndroID studio.
更新:它适用于所有 API 30 级别的设备,但不适用于更低的设备,我尝试更改最小 sdk 版本、编译 sdk 版本和构建 sdk 版本,但不走运。不知道该怎么办。帮助将不胜感激。谢谢。
我发现了错误。问题与我的代码或构建配置无关,而是模拟器本身。我删除/重新安装了模拟器,一切正常。
希望这能帮助任何遇到同样问题的人。
以上是大佬教程为你收集整理的为什么我的应用程序能够在较新的设备上运行,但不能在较旧的设备上运行(向后兼容性 build.gradle 问题)?全部内容,希望文章能够帮你解决为什么我的应用程序能够在较新的设备上运行,但不能在较旧的设备上运行(向后兼容性 build.gradle 问题)?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。