Android错误:软件包android.os不存在

编程入门 行业动态 更新时间:2024-10-26 17:32:36
本文介绍了Android错误:软件包android.os不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已使用Gradle将项目导入Android Studio.导入过程成功,但是在尝试导入android.os.*时出现错误. 这是一个libGDX项目.

I have imported a project to Android Studio using Gradle. Import process was successful, but it gives an error for android.os.*, when I try to import it. It is a libGDX project.

推荐答案

最近,我在Android Studio 3.2.1 Ubuntu/Linux版本中遇到了类似情况.

Recently, I met a similar case in Android Studio 3.2.1 Ubuntu/Linux version.

我非常确定该问题与Android SDK的安装有关,因为我在Windows 10笔记本电脑的Android Studio中构建了相同的项目.

I am quite sure about the issue shall be related to the Android SDK installation,because I build the same project in Android Studio of my Windows 10 laptop.

问题: Android Studio中的Java编译器错误

Issue: Java compiler error at Android studio

error: package android.os does not exist error: package android.media does not exist error: package android.content does not exist error: package android.util does not exist error: cannot find symbol variable Log error: cannot find symbol class Context error: cannot find symbol class AudioRecord

解决方案: 在build.gradle文件中提到的android.jar未安装在/sdk/platforms/目录中.请参阅下面我的build.gradle文件中的android.jar依赖项(这引起了问题),

Solution: The android.jar which was mentioned at the build.gradle file was not installed at the /sdk/platforms/ directory. See the android.jar dependency at my build.gradle file below(which caused the issue),

dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile files(sdkDir+'/platforms/android-24/android.jar') }

安装正确的android平台(如果有build.gradle文件,请参阅正确的API级别)并重建项目.

Install the correct android platform(correct API level as mentioned in the build.gradle file,if any) and rebuild the project.

更多推荐

Android错误:软件包android.os不存在

本文发布于:2023-06-08 06:30:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/576132.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:软件包   不存在   错误   Android   android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!