Android(安卓)Studio编译从eclipse导入的项目时出现问题总结
开发环境:
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
就可以
更多相关文章
- Android输入框被键盘遮挡
- android studio中rendering problems解决方法
- Android(安卓)RecyclerView 报错:java.lang.IllegalStateExceptio
- TabHost和android:layout_height="0.0dip"以及android:layout_we
- 《阿里巴巴Android开发手册》正式发布,安卓开发者的福音
- android,编译过程遇到的错误
- 【阿里云镜像】切换阿里巴巴开源镜像站镜像——Fedora镜像
- 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程
- 【阿里云镜像】切换阿里巴巴开源镜像站镜像——Debian镜像