gpt4 book ai didi

android - Android Studio-错误:程序包java.awt.geom不存在

转载 作者:行者123 更新时间:2023-12-03 05:01:13 27 4
gpt4 key购买 nike

我正在将应用程序从Eclipse迁移到Android Studio。当我编译代码时:

import java.awt.geom.Area;

我得到

error: package java.awt.geom does not exist



建立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'
}

关于如何解决这个问题有什么建议吗?这是gradle问题吗?我应该包括文件并用作库吗?

最佳答案

@CommonsWare建议我不要使用java.awt库,这可能是长期建议。

另一方面,要解决当前的问题,请downloaded the library解压缩文件,然后将jar文件(java-rt-jar-stubs-1.5.0.jar)放在libs文件夹中。

然后,我右键单击jar文件,然后选择Add as library

问题解决了。

关于android - Android Studio-错误:程序包java.awt.geom不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36769851/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com