我正在将应用程序从Eclipse迁移到Android Studio。当我像这样编译代码时:
import java.awt.geom.Area;
我明白了
错误:程序包java.awt.geom不存在
建立gradle
apply plugin: 'com.android.application'
android {
//compileSdkVersion 'Google Inc.:Google APIs:8'
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.me.droider"
minSdkVersion 13
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
debuggable true
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
//compile files('libs/osmdroid-android-4.2.jar')
compile files('libs/osmdroid-android-4.3.jar')
compile 'javax.annotation:jsr250-api:1.0'
}
关于如何解决这个问题有什么建议吗?这是一个摇摇欲坠的问题吗?我应该包括文件并用作库吗?
@CommonsWare建议我不要使用java.awt
库,这可能是长期建议。
另一方面,为了解决当前的问题,我下载了库,解压缩了文件,然后将jar文件(java-rt-jar-stubs-1.5.0.jar)放在libs
文件夹中。
然后,我右键单击jar文件并选择Add as library
。
问题解决了。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句