开发环境:
Android Studio 3.3.2
Build #AI-182.5107.16.33.5314842, built on February 16, 2019
JRE: 1.8.0_152-release-1248-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

运行环境:
Android SDK 28 (Android 9.0(Pie))
minSdkVersion 19
targetSdkVersion 28


Error: Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.2/gradle-3.3.2.pom'. Received status code 502 from server: Bad Gateway Enable Gradle 'offline mode' and sync project

解决方法:
build.gradle(Project:)中,

buildscript {    repositories {        jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:3.3.2'    }}

jcenter()
改为:
jcenter { url 'https://maven.aliyun.com/repository/jcenter' }

buildscript {    repositories {        jcenter { url 'https://maven.aliyun.com/repository/jcenter' }    }    dependencies {        classpath 'com.android.tools.build:gradle:3.3.2'    }}

相当于把jcenter的远程仓库改为阿里云的仓库


ERROR: The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.Remove minSdkVersion and sync projectAffected Modules: appWARNING: The targetSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.Remove targetSdkVersion and sync projectAffected Modules: app

解决方法:
把AndroidManifest.xml文件里的这一段删除

 

之后在app/build.gradle(module:app)里指定minSdk和targetSdk;
compileSdk要改成实际编译运行时的版本

android {    compileSdkVersion 28    buildToolsVersion "28.0.3"    defaultConfig {        applicationId "com.example.zc_01"        minSdkVersion 19        targetSdkVersion 28    }

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.htmlAffected Modules: app

app/build.gradle(module:app)

dependencies {    compile 'com.android.support:appcompat-v7:18.0.0'    compile 'com.android.support:appcompat-v7:18.0.0'    compile 'com.android.support:support-v4:18.0.0'}

改为:

dependencies {    implementation fileTree(dir: 'libs', include: ['*.jar'])    implementation 'com.android.support:appcompat-v7:28.0.0'    testImplementation 'junit:junit:4.12'    androidTestImplementation 'com.android.support.test:runner:1.0.2'    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'}

错误: 找不到符号
符号: 类 ActionBarActivity
位置: 程序包 android.support.v7.app

这是因为ActionBarActivity 过时,
ActionBarctivity 已被它的父类AppCompatActivity替代了
所以 MainActivity 继承改为 AppCompatActivity 就可以

更多相关文章

  1. Android输入框被键盘遮挡
  2. android studio中rendering problems解决方法
  3. Android(安卓)RecyclerView 报错:java.lang.IllegalStateExceptio
  4. TabHost和android:layout_height="0.0dip"以及android:layout_we
  5. 《阿里巴巴Android开发手册》正式发布,安卓开发者的福音
  6. android,编译过程遇到的错误
  7. 【阿里云镜像】切换阿里巴巴开源镜像站镜像——Fedora镜像
  8. 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程
  9. 【阿里云镜像】切换阿里巴巴开源镜像站镜像——Debian镜像

随机推荐

  1. Iphone,Imac,Win7,Android的日历同步
  2. 笔记77-listview属性介绍
  3. 转载:Android service 实现过程
  4. Tiny4412_android5.0.2编译
  5. Android Java和JavaScript代码相互调用
  6. android中使用Intent在activity之间传递
  7. android中各种permissiond详解
  8. Android Studio SVN 使用方法
  9. Android(安卓)命令行打包和签名
  10. android EditView ime