初始化LitePal时遇到的问题
Author: chofuhoyuCreated Mar 21, 2022Updated Jul 17, 2024
按照README中的说明依次添加了
- build.gradle中的dependencies
dependencies {
implementation 'org.litepal.guolindev:core:3.2.3'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}- 在app/src/main中新建文件夹assets并添加litepal.xml(已粘贴对应内容)

- 在AndroidManifest.xml中配置
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.litepaltest">
<application
android:name="org.litepal.LitePalApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LitePalTest">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>这里就开始有问题了,IDE报错


- 在实际使用当中找不到LitePal
此时已经在litepal.xml中添加了对应关系

报错信息为Cannot resolve symbol 'LitePal'
请问是我遗漏了什么步骤或者哪里做错了吗?还是说有哪些通识性的问题,比如说在gradle添加完某个新的依赖之后还要进行一些特别的设置才能使用?
Source: guolindev/LitePal