LitePal icon indicating copy to clipboard operation
LitePal copied to clipboard

初始化LitePal时遇到的问题

Open DistinctWind opened this issue 2 years ago • 6 comments

按照README中的说明依次添加了

  1. 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'
}
  1. 在app/src/main中新建文件夹assets并添加litepal.xml(已粘贴对应内容)
image
  1. 在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报错

image image
  1. 在实际使用当中找不到LitePal

此时已经在litepal.xml中添加了对应关系

image

报错信息为Cannot resolve symbol 'LitePal'


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

DistinctWind avatar Mar 21 '22 00:03 DistinctWind

兄弟解决没,我跟你一样是这个问题

Fzlkjbk avatar Mar 30 '22 15:03 Fzlkjbk

并没有解决,现在我是直接用安卓自带的数据库。

学学SQL问题也能解决😂能操控数据库就行

DistinctWind avatar Mar 31 '22 00:03 DistinctWind

兄弟,去这个网址看一下,我看见这个教程可以,你试试,我按照它的步骤,只改了settings.gradle就已经好了 教程网址

195779 avatar Apr 02 '22 00:04 195779

同样的问题没法解决

WangLanjue avatar Jun 13 '22 12:06 WangLanjue