make module报错找不到符号 import android.support.v4.app.ActivityCompat; ^ 符号: 类 ActivityCompat 位置: 程序包 android.support.v4.app,有添加依赖库implementation 'com.android.support:appcompat-v7:28.0.0'
时间: 2024-02-28 10:54:39 浏览: 31
这个错误提示是在Java文件中找不到符号`ActivityCompat`。这个错误一般是由于缺少相关的依赖包或者版本不匹配导致的。请检查你的项目中是否已经导入了`android.support.v4`依赖库,并且版本是否正确。
从你提供的信息来看,你只添加了`appcompat-v7`依赖库,而没有添加`support-v4`依赖库。在`build.gradle`文件中添加以下依赖:
```
dependencies {
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
}
```
这样就可以解决找不到`ActivityCompat`的问题了。如果还是无法解决问题,请尝试清除项目并重新构建。
相关问题
import android.support.v7.app.AppCompatActivity;出现cannot resolve symbol ‘app’
This error message usually occurs when the support library is not properly added to the project.
To resolve this issue, you can try the following steps:
1. Make sure that your project level build.gradle file has the required dependencies added for the support library.
2. Synchronize the gradle files by clicking on the "Sync Now" button in the toolbar or by selecting "Sync Project with Gradle Files" from the "File" menu.
3. Clean and rebuild the project by selecting "Clean Project" and "Rebuild Project" from the "Build" menu.
If none of the above steps work, you can try adding the following line to your app level build.gradle file under the dependencies section:
```
implementation 'com.android.support:appcompat-v7:28.0.0'
```
This will add the support library to your project and resolve the 'cannot resolve symbol app' error.
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.LocalBroadcastManager"
This error message indicates that the application is trying to use the LocalBroadcastManager class from the Android Support Library, but the class is not present in the application's classpath.
To solve this issue, you can try the following steps:
1. Make sure that you have added the Android Support Library to your project's dependencies. You can do this by adding the following line to your app's build.gradle file:
implementation 'com.android.support:support-v4:28.0.0'
2. If you have already added the Android Support Library, try cleaning and rebuilding your project. Sometimes, the build process can fail to update the classpath, which can cause this error.
3. If the above steps do not work, try updating the Android Support Library to the latest version. You can do this by changing the version number in the implementation statement in your build.gradle file:
implementation 'com.android.support:support-v4:28.0.0' -> implementation 'com.android.support:support-v4:28.0.0-alpha1'
4. If none of the above steps work, try adding the following line to your app's build.gradle file:
android {
...
useLibrary 'org.apache.http.legacy'
...
}
This will enable the use of the deprecated Apache HTTP client library, which may be required by some older versions of the Android Support Library.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)