LitePal
LitePal copied to clipboard
初始化LitePal时遇到的问题
按照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添加完某个新的依赖之后还要进行一些特别的设置才能使用?
兄弟解决没,我跟你一样是这个问题
并没有解决,现在我是直接用安卓自带的数据库。
学学SQL问题也能解决😂能操控数据库就行
兄弟,去这个网址看一下,我看见这个教程可以,你试试,我按照它的步骤,只改了settings.gradle就已经好了 教程网址
同样的问题没法解决