嗨,伙计们,我有一个关于使用房间向数据库插入数据的问题 5.我试了很多方法,但都不管用,也许你能帮我解决这个问题

问题是,当我使用setOnClickListener点击FAB按钮时,我想插入数据

binding.favoriteButton.setOnClickListener {
            val userId = item
            if (userId != null) {
                viewModel.viewModelScope.launch {
                    if (viewModel.isFavorite.value == true) {
                        viewModel.delete(userId)
                        Log.d("DetailUserActivity", "User dengan ID $userId dihapus dari favorit.")
                    } else {
                        viewModel.insert(userId)
                        Log.d("DetailUserActivity", "User dengan ID $userId ditambah ke favorit.")
                    }
                }
            }
        }

在setOnClickListener中我判断用户ID,如果ID不在数据库中,我会使用INSERT函数发送数据,如果数据在数据库中,我会使用DELETE函数删除数据,但问题是数据不能在数据库中插入或删除,我已经判断了应用程序判断器,但数据没有显示,在Log Cat中有一个错误,我不明白这是什么意思,这里是错误:

 E  Failed to open QEMU pipe 'qemud:network': Invalid argument
 E  RemoteConnection failed to initialize: RemoteConnection failed to open pipe
E Couldn't load memtrack module

注意:我的连接正常,所以我认为错误不是来self 的连接

以下是我的代码:

//DetailUserActivit.kt

    package com.example.projectone.userdetail

    import androidx.appcompat.app.AppCompatActivity
    import android.os.Bundle
    import android.util.Log
    import android.view.MenuItem
    import android.widget.Toast
    import androidx.activity.viewModels
    import androidx.core.content.ContextCompat
    import androidx.core.view.isVisible
    import androidx.fragment.app.Fragment
    import androidx.lifecycle.viewModelScope
    import coil.load
    import coil.transform.CircleCropTransformation
    import com.example.project_one.R
    import com.example.project_one.databinding.ActivityDetailUserBinding
    import com.example.projectone.data.model.ResponseDetailUserGithub
    import com.example.projectone.data.model.ResponseUserGithub
    import com.example.projectone.userdetail.fragment.UserFollower
    import com.example.projectone.utils.ResultViewModel
    import com.google.android.material.tabs.TabLayout
    import com.google.android.material.tabs.TabLayoutMediator
    import kotlinx.coroutines.Dispatchers
    import kotlinx.coroutines.launch
    import kotlinx.coroutines.withContext


    class DetailUserActivity : AppCompatActivity() {
        private lateinit var binding: ActivityDetailUserBinding
        private val viewModel by viewModels<DetailUserViewModel>{
            DetailViewModelFactory(application)
        }

        private var isFavorite = false


        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            binding = ActivityDetailUserBinding.inflate(layoutInflater)
            setContentView(binding.root)
            supportActionBar?.setDisplayHomeAsUpEnabled(true)

            val item = intent.getParcelableExtra<ResponseUserGithub.Item>("userItems")
            val username = item?.login ?: "User Not Found"

            viewModel.resultDetailUser.observe(this) {
                when(it) {
                    is ResultViewModel.Success<*> -> {
                        val user = it.data as ResponseDetailUserGithub
                        binding.imageUser.load(user.avatar_url) {
                            transformations(CircleCropTransformation())
                        }

                        binding.fullNames.text = user.name
                        binding.username.text = user.login
                        binding.followerCount.text = user.followers.toString()
                        binding.followingCount.text = user.following.toString()
                        binding.repositoryCount.text = user.public_repos.toString()


                    }
                    is ResultViewModel.Error -> {
                        Toast.makeText(this, it.exception.message.toString(), Toast.LENGTH_SHORT).show()
                    }
                    is ResultViewModel.Loading -> {
                        binding.progressBar.isVisible = it.isLoading
                    }
                }
            }

            viewModel.getUser(username)
            val fragments = mutableListOf<Fragment>(
                UserFollower.newInstance(UserFollower.FOLLOWERS),
                UserFollower.newInstance(UserFollower.FOLLOWING)
            )
            val titleTabFragments = mutableListOf(
                getString(R.string.follower_tab), getString(R.string.following_tab)
            )
            val adapter = DetailUserAdapter(this, fragments)
            binding.viewPager.adapter = adapter

            TabLayoutMediator(binding.tabLayout, binding.viewPager) {tab, position ->
                tab.text = titleTabFragments[position]
            }.attach()

            binding.tabLayout.addOnTabSelectedListener(object: TabLayout.OnTabSelectedListener {
                override fun onTabSelected(tab: TabLayout.Tab?) {
                    if (tab?.position == 0) {
                        viewModel.getFollowerUser(username)
                    } else {
                        viewModel.getFollowingUser(username)
                    }
                }

                override fun onTabUnselected(tab: TabLayout.Tab?) {
                }

                override fun onTabReselected(tab: TabLayout.Tab?) {
                }

            })
            viewModel.getFollowerUser(username)

            viewModel.resultFavoriteAdd.observe(this) {
                updateFavoriteButtonColor(true)
            }
            viewModel.resultFavoriteDelete.observe(this) {
                updateFavoriteButtonColor(false)
            }

            viewModel.isFavorite.observe(this) { isFavoriteValue ->
                updateFavoriteButtonColor(isFavoriteValue)
            }


            binding.favoriteButton.setOnClickListener {
                val userId = item
                if (userId != null) {
                    viewModel.viewModelScope.launch {
                        // Cek status isFavorite berdasarkan status saat ini
                        if (isFavorite) {
                            // Jika sebelumnya adalah favorit, hapus dari database

                                viewModel.delete(userId)

                            // Perbarui status isFavorite dan tombol favorit
                            isFavorite = false
                            updateFavoriteButtonColor(false)
                            Log.d("DetailUserActivity", "User dengan ID $userId dihapus dari favorit.")
                        } else {
                            // Jika sebelumnya tidak favorit, tambahkan ke database

                                viewModel.insert(userId)

                            // Perbarui status isFavorite dan tombol favorit
                            isFavorite = true
                            updateFavoriteButtonColor(true)
                            Log.d("DetailUserActivity", "User dengan ID $userId ditambahkan ke favorit.")
                        }
                    }
                }
            }



        }



        private fun updateFavoriteButtonColor(isFavorite: Boolean) {
            val colorRes = if (isFavorite) R.color.lavender else android.R.color.white
            val color = ContextCompat.getColor(this, colorRes)
            binding.favoriteButton.setColorFilter(color)
        }


        override fun onOptionsItemSelected(item: MenuItem): Boolean {
            when(item.itemId) {
                android.R.id.home -> {
                    finish()
                }
            }

            return super.onOptionsItemSelected(item)
        }
    }

//DetailViewModel.kt


    import android.app.Application
    import android.util.Log
    import androidx.lifecycle.LiveData
    import androidx.lifecycle.MutableLiveData
    import androidx.lifecycle.ViewModel
    import androidx.lifecycle.ViewModelProvider
    import androidx.lifecycle.viewModelScope
    import com.example.projectone.data.db.FavDao
    import com.example.projectone.data.model.ResponseUserGithub
    import com.example.projectone.data.repo.FavoriteRepository
    import com.example.projectone.data.service.ApiClient
    import com.example.projectone.utils.ResultViewModel
    import kotlinx.coroutines.Dispatchers
    import kotlinx.coroutines.flow.catch
    import kotlinx.coroutines.flow.flow
    import kotlinx.coroutines.flow.onCompletion
    import kotlinx.coroutines.flow.onStart
    import kotlinx.coroutines.launch

    class DetailUserViewModel(application: Application) : ViewModel() {
        val resultDetailUser = MutableLiveData<ResultViewModel>()
        val resultFollowersUser = MutableLiveData<ResultViewModel>()
        val resultFollowingUser = MutableLiveData<ResultViewModel>()
        val resultFavoriteAdd = MutableLiveData<ResultViewModel>()
        val resultFavoriteDelete = MutableLiveData<ResultViewModel>()
        val resultFavoriteCheck = MutableLiveData<ResultViewModel>()

        val myGithubDetail = MutableLiveData<ResultViewModel>()
        val myFollowerUser = MutableLiveData<ResultViewModel>()
        val myFollowingUser = MutableLiveData<ResultViewModel>()


        private val mFavRepo: FavoriteRepository = FavoriteRepository(application)

        private val _isFavorite = MutableLiveData<Boolean>()
        val isFavorite: LiveData<Boolean> = _isFavorite
        
        suspend fun insert(fav: ResponseUserGithub.Item) {
                if (_isFavorite.value != null) {
                    if (_isFavorite.value == true) {
                            mFavRepo.insert(fav)
                            resultFavoriteAdd.value = ResultViewModel.Success(true)
                    }
                }

            _isFavorite.value = _isFavorite.value != true
        }

        suspend fun delete(fav: ResponseUserGithub.Item) {
                if (_isFavorite.value != null) {
                    if (_isFavorite.value == true) {
                        mFavRepo.delete(fav)
                        resultFavoriteDelete.value = ResultViewModel.Success(true)
                    }
                }

            _isFavorite.value = _isFavorite.value != true
        }

        fun findById(id: Int) {
            viewModelScope.launch {
                val isFavoriteValue = mFavRepo.findById(id) != null
                _isFavorite.postValue(isFavoriteValue)
            }
        }


        fun getUser(username: String) {
            viewModelScope.launch {
                flow {
                    val response = ApiClient
                        .githubService
                        .getDetailUserFromGithub(username)
                    emit(response)
                } .onStart {
                    resultDetailUser.value = ResultViewModel.Loading(true)
                } .onCompletion {
                    resultDetailUser.value = ResultViewModel.Loading(false)
                } .catch {
                    Log.e("Error ", it.message.toString())
                    it.printStackTrace()
                    resultDetailUser.value = ResultViewModel.Error(it)
                } .collect {
                    // Ubah tipe data yang dikirimkan ke resultSuccess.value
                    resultDetailUser.value = ResultViewModel.Success(it)
                }
            }
        }

        fun getFollowerUser(username: String) {
            viewModelScope.launch {
                flow {
                    val response = ApiClient
                        .githubService
                        .getFollowerUserFromGithub(username)
                    emit(response)
                } .onStart {
                    resultFollowersUser.value = ResultViewModel.Loading(true)
                } .onCompletion {
                    resultFollowersUser.value = ResultViewModel.Loading(false)
                } .catch {
                    Log.e("Error ", it.message.toString())
                    it.printStackTrace()
                    resultFollowersUser.value = ResultViewModel.Error(it)
                } .collect {
                    // Ubah tipe data yang dikirimkan ke resultSuccess.value
                    resultFollowersUser.value = ResultViewModel.Success(it)
                }
            }
        }

        fun getFollowingUser(username: String) {
            viewModelScope.launch {
                flow {
                    val response = ApiClient
                        .githubService
                        .getFollowingUserFromGithub(username)
                    emit(response)
                } .onStart {
                    resultFollowingUser.value = ResultViewModel.Loading(true)
                } .onCompletion {
                    resultFollowingUser.value = ResultViewModel.Loading(false)
                } .catch {
                    Log.e("Error ", it.message.toString())
                    it.printStackTrace()
                    resultFollowingUser.value = ResultViewModel.Error(it)
                } .collect {
                    // Ubah tipe data yang dikirimkan ke resultSuccess.value
                    resultFollowingUser.value = ResultViewModel.Success(it)
                }
            }
        }

        fun getMyGithub(username: String) {
            viewModelScope.launch {
                flow {
                    val response = ApiClient
                        .githubService
                        .getMyGithub(username)
                    emit(response)
                } .onStart {
                    myGithubDetail.value = ResultViewModel.Loading(true)
                } .onCompletion {
                    myGithubDetail.value = ResultViewModel.Loading(false)
                } .catch {
                    Log.e("Error ", it.message.toString())
                    it.printStackTrace()
                    myGithubDetail.value = ResultViewModel.Error(it)
                } .collect {
                    // Ubah tipe data yang dikirimkan ke resultSuccess.value
                    myGithubDetail.value = ResultViewModel.Success(it)
                }
            }
        }

        fun getMyFollower(username: String) {
            viewModelScope.launch {
                flow {
                    val response = ApiClient
                        .githubService
                        .getMyFollowerGithub(username)
                    emit(response)
                } .onStart {
                    myFollowerUser.value = ResultViewModel.Loading(true)
                } .onCompletion {
                    myFollowerUser.value = ResultViewModel.Loading(false)
                } .catch {
                    Log.e("Error ", it.message.toString())
                    it.printStackTrace()
                    myFollowerUser.value = ResultViewModel.Error(it)
                } .collect {
                    // Ubah tipe data yang dikirimkan ke resultSuccess.value
                    myFollowerUser.value = ResultViewModel.Success(it)
                }
            }
        }

        fun getMyFollowing(username: String) {
            viewModelScope.launch {
                flow {
                    val response = ApiClient
                        .githubService
                        .getMyFollowingGithub(username)
                    emit(response)
                } .onStart {
                    myFollowingUser.value = ResultViewModel.Loading(true)
                } .onCompletion {
                    myFollowingUser.value = ResultViewModel.Loading(false)
                } .catch {
                    Log.e("Error ", it.message.toString())
                    it.printStackTrace()
                    myFollowingUser.value = ResultViewModel.Error(it)
                } .collect {
                    // Ubah tipe data yang dikirimkan ke resultSuccess.value
                    myFollowingUser.value = ResultViewModel.Success(it)
                }
            }
        }
    }

    class DetailViewModelFactory(private val application: Application) : ViewModelProvider.NewInstanceFactory() {
        override fun <T : ViewModel> create(modelClass: Class<T>): T {
            if (modelClass.isAssignableFrom(DetailUserViewModel::class.java)) {
                @Suppress("UNCHECKED_CAST")
                return DetailUserViewModel(application) as T
            }
            throw IllegalAccessException("Unkwon ViewModel :" + modelClass.name)
        }
    }

//FavoritRepository.kt

    import android.app.Application
    import androidx.lifecycle.LiveData
    import com.example.projectone.data.db.FavDao
    import com.example.projectone.data.db.FavDb
    import com.example.projectone.data.model.ResponseUserGithub
    import kotlinx.coroutines.Dispatchers
    import kotlinx.coroutines.withContext
    import java.util.concurrent.ExecutorService
    import java.util.concurrent.Executors

    class FavoriteRepository( application: Application) {


        private val mFavDao: FavDao
        private val executorService: ExecutorService = Executors.newFixedThreadPool(4)
        init {
            val db = FavDb.getDatabase(application)
            mFavDao = db.FavDao()
        }
        fun getAllFavUser(): LiveData<MutableList<ResponseUserGithub.Item>> = mFavDao.loadAll()
        fun insert(fav: ResponseUserGithub.Item) {
            executorService.execute { mFavDao.insertFav(fav) }
        }
        fun delete(fav: ResponseUserGithub.Item) {
            executorService.execute { mFavDao.deleteFav(fav) }
        }

        fun findById(id: Int): LiveData<ResponseUserGithub.Item?> {
            return mFavDao.findByid(id)
        }


    }

~FavDao.kt

    import androidx.lifecycle.LiveData
    import androidx.room.Dao
    import androidx.room.Delete
    import androidx.room.Insert
    import androidx.room.OnConflictStrategy
    import androidx.room.Query
    import com.example.projectone.data.model.ResponseUserGithub

    @Dao
    interface FavDao {
        @Insert(onConflict = OnConflictStrategy.REPLACE)
        fun insertFav(user: ResponseUserGithub.Item)

        @Query("SELECT * FROM user")
        fun loadAll(): LiveData<MutableList<ResponseUserGithub.Item>>

        @Query("SELECT * FROM user WHERE id LIKE :id LIMIT 1")
        fun findByid(id: Int): LiveData<ResponseUserGithub.Item?>

        @Delete
        fun deleteFav(user: ResponseUserGithub.Item)=
    }

//FavDb.kt

import android.content.Context
import android.provider.ContactsContract
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.example.projectone.data.model.ResponseUserGithub

@Database(entities = [ResponseUserGithub.Item::class], version = 1)
abstract class FavDb : RoomDatabase() {
    abstract fun FavDao(): FavDao
    companion object {
        @Volatile
        private var INSTANCE: FavDb? = null
        @JvmStatic
        fun getDatabase(context: Context): FavDb {
            if (INSTANCE == null) {
                synchronized(FavDb::class.java) {
                    INSTANCE = Room.databaseBuilder(context.applicationContext,
                        FavDb::class.java, "fav_database")
                        .build()
                }
            }
            return INSTANCE as FavDb
        }
    }
}

//ResponseUseGithub.kt

import android.os.Parcelable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlinx.parcelize.Parcelize

data class ResponseUserGithub(
    val incomplete_results: Boolean,
    val items: List<Item>,
    val total_count: Int
) {
    @Parcelize
    @Entity(tableName = "user")
    data class Item(
        @ColumnInfo(name = "avatar_url")
        val avatar_url: String,
        @PrimaryKey
        val id: Int,
        @ColumnInfo(name = "login")
        val login: String
    ) : Parcelable

}

也许你能帮我,教我如何解决这个问题

推荐答案

在try 确定问题所在位置时,通常最好将位置降至最低.您有很多代码,问题可能存在于许多地方(据猜测,可能是由于主线程的运行(这是推荐的)).

因此,您可以很容易地将问题分成两部分:

  1. 是实际访问数据库(插入和删除数据)的问题,还是
  2. 是由主线程检索从主线程运行的数据的问题.

通过在主线程上插入和删除一些代码更改,就可以很容易地建立第一个代码.如果这些都有效,那么问题就出在2上.

所以如果你:-

  1. .allowMainThreadQueries临时添加到由dataBaseBuilder调用的方法中,数据库访问可以在主线程上使用.
    1. 显然在问题解决后删除此选项.
  2. 临时更改@Dao个函数,使其使用LiveData,例如使用fun loadAll(): /*LiveData<*/MutableList<ResponseUserGithub.Item>/*>*/
  3. 更改或添加将利用主线程的活动代码,例如演示/显示数据库代码是否正常.已使用以下活动代码

:-

class MainActivity : AppCompatActivity() {

    lateinit var db: FavDb
    lateinit var dao: FavDao
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        db = FavDb.getDatabase(this)
        dao = db.FavDao()

        dao.insertFav(ResponseUserGithub.Item("avatarURL001",0,"loginA"))
        dao.insertFav(ResponseUserGithub.Item("avatarURL002",1,"loginB"))
        dao.insertFav(ResponseUserGithub.Item("avatarURL003",2,"loginC"))
        dao.insertFav(ResponseUserGithub.Item("avatarURL004",-99,"loginD"))
        logStuff("STG001")
        val rowsDeleted = dao.deleteFav(ResponseUserGithub.Item("not an avatarURL????",1,"not a loginZ"))
        logStuff("STG002_DLT${rowsDeleted}")

    }

    fun logStuff(tagSuffix: String) {
        for (i in dao.loadAll()) {
            Log.d("ITEMINFO_${tagSuffix}","Item avatarURL is ${i.avatar_url} Login is ${i.login} ID is ${i.id}")
        }
    }
}

This in addition to the temporary changes made for 1 and 2 which result in:-

@Dao
interface FavDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertFav(user: ResponseUserGithub.Item)

    @Query("SELECT * FROM user")
    fun loadAll(): /*LiveData<*/MutableList<ResponseUserGithub.Item>/*>*/

    @Query("SELECT * FROM user WHERE id LIKE :id LIMIT 1")
    fun findByid(id: Int): LiveData<ResponseUserGithub.Item?>

    @Delete
    fun deleteFav(user: ResponseUserGithub.Item)/*= ????? */: Int
}

@Database(entities = [ResponseUserGithub.Item::class], version = 1)
abstract class FavDb : RoomDatabase() {
    abstract fun FavDao(): FavDao
    companion object {
        @Volatile
        private var INSTANCE: FavDb? = null
        @JvmStatic
        fun getDatabase(context: Context): FavDb {
            if (INSTANCE == null) {
                synchronized(FavDb::class.java) {
                    INSTANCE = Room.databaseBuilder(context.applicationContext,
                        FavDb::class.java, "fav_database")
                        .allowMainThreadQueries() /* ADDDED FOR INITIAL DEBUG */
                        .build()
                }
            }
            return INSTANCE as FavDb
        }
    }
}
  • 100仍然是unchanged

When the App is first run using the above, then:-

日志(log)包括

:-

2023-09-29 09:38:47.689 D/ITEMINFO_STG001: Item avatarURL is avatarURL004 Login is loginD ID is -99
2023-09-29 09:38:47.690 D/ITEMINFO_STG001: Item avatarURL is avatarURL001 Login is loginA ID is 0
2023-09-29 09:38:47.690 D/ITEMINFO_STG001: Item avatarURL is avatarURL002 Login is loginB ID is 1
2023-09-29 09:38:47.690 D/ITEMINFO_STG001: Item avatarURL is avatarURL003 Login is loginC ID is 2

2023-09-29 09:38:47.694 D/ITEMINFO_STG002_DLT1: Item avatarURL is avatarURL004 Login is loginD ID is -99
2023-09-29 09:38:47.694 D/ITEMINFO_STG002_DLT1: Item avatarURL is avatarURL001 Login is loginA ID is 0
2023-09-29 09:38:47.694 D/ITEMINFO_STG002_DLT1: Item avatarURL is avatarURL003 Login is loginC ID is 2
  • 因此,显然已经添加了4行(STG001),并且
  • 一行已被删除,因此STG002显示3行(DLT后跟1,即从@Dalete返回的结果,即受影响(删除)的行数).
    • 您可能会问,当要删除的Item(使用"not an avatarURL????",1,"not a loginZ"构造)不是添加的Item时,为什么要删除一行.答案是,AN @Delete(与AN @Update一样)使用主键来确定受影响的行.对于AN @Delete,其他字段无关紧要,对于更新,其他字段将是更新应用的值.

Using App Inspection then:-

enter image description here

这进一步确认插入和删除确实有效,并且问题不是由数据库/房间代码引起的,而是由UI代码引起的.

This answer is only intended to assist with reducing the scope of the issue to the UI code and thus eliminating issues with the Room code.

Log Cat中有一个错误,我不明白这是什么意思,错误是这样的:

Logcat中的错误经常发生,但不会导致App崩溃.由于您在运行App之后使用了App判断(并假设它没有发出无法打开数据库的消息),因此很可能App没有崩溃/停止.如果它显示了数据库组件,则应用程序没有崩溃,错误消息(应用程序判断经常生成的)很可能是应用程序判断正在做它的工作.

e.g. consider the following which is the log from when App Inspection was started:-

2023-09-29 10:14:38.307 5453-5453/a.a.so77195407kotlinroomnotinserting E/libc: Access denied finding property "ro.serialno"
2023-09-29 10:14:38.314 5453-5560/a.a.so77195407kotlinroomnotinserting D/StudioTransport: Receiving kDaemonConnectRequest, receive_fd=55 current_fd_=-1
2023-09-29 10:14:38.314 5453-5560/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Create gRPC channel on fd-based target 'unix:&55'
2023-09-29 10:14:38.293 5453-5453/a.a.so77195407kotlinroomnotinserting W/oomnotinserting: type=1400 audit(0.0:2551): avc: denied { read } for name="u:object_r:serialno_prop:s0" dev="tmpfs" ino=6282 scontext=u:r:untrusted_app:s0:c229,c258,c512,c768 tcontext=u:object_r:serialno_prop:s0 tclass=file permissive=0
2023-09-29 10:14:38.326 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent command stream started.
2023-09-29 10:14:38.331 5453-5559/a.a.so77195407kotlinroomnotinserting V/StudioTransport: JNIEnv not attached
2023-09-29 10:14:38.341 5453-5559/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Memory control stream started.
2023-09-29 10:14:38.566 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/job/JobService
2023-09-29 10:14:38.743 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/AlarmManager
2023-09-29 10:14:38.921 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/location/LocationManager
2023-09-29 10:14:39.094 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/IntentService
2023-09-29 10:14:39.265 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/job/JobServiceEngine$JobHandler
2023-09-29 10:14:39.466 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/location/LocationManager$ListenerTransport
2023-09-29 10:14:39.641 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/JobSchedulerImpl
2023-09-29 10:14:39.816 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/AlarmManager$ListenerWrapper
2023-09-29 10:14:39.985 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/os/PowerManager
2023-09-29 10:14:40.152 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/os/PowerManager$WakeLock
2023-09-29 10:14:40.322 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/PendingIntent
2023-09-29 10:14:40.496 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/os/Debug
2023-09-29 10:14:40.678 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/ActivityThread
2023-09-29 10:14:40.851 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/Instrumentation
2023-09-29 10:14:40.936 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: java/net/URL
2023-09-29 10:14:40.950 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: androidx/fragment/app/Fragment
2023-09-29 10:14:40.956 5453-5453/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
2023-09-29 10:14:40.956 5453-5453/a.a.so77195407kotlinroomnotinserting I/chatty: uid=10741(a.a.so77195407kotlinroomnotinserting) identical 14 lines
2023-09-29 10:14:40.957 5453-5453/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
2023-09-29 10:14:40.966 5453-5453/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Class android.os.PowerManager$WakeLock failed lock verification and will run slower.
2023-09-29 10:14:40.966 5453-5453/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Common causes for lock verification issues are non-optimized dex code
2023-09-29 10:14:40.966 5453-5453/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: and incorrect proguard optimizations.
2023-09-29 10:14:41.015 5453-5453/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Profiler initialization complete on agent.
2023-09-29 10:14:41.015 5453-5559/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Transport agent connected to daemon.
2023-09-29 10:14:41.019 5453-5573/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Acquiring Application for Events
2023-09-29 10:14:41.034 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:23 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:41.034 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: JNIEnv not attached
2023-09-29 10:14:41.143 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:24 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:41.257 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:25 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:41.495 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:26 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:41.501 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:27 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:41.503 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:28 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:41.493 5453-5453/a.a.so77195407kotlinroomnotinserting W/a.a.so77195407kotlinroomnotinserting: type=1400 audit(0.0:2552): avc: denied { write } for comm=656374696F6E207072696D6172795D name="perfd" dev="dm-1" ino=36658 scontext=u:r:untrusted_app:s0:c229,c258,c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
2023-09-29 10:14:41.503 5453-5453/a.a.so77195407kotlinroomnotinserting I/chatty: uid=10741(a.a.so77195407kotlinroomnotinserting) identical 4 lines
2023-09-29 10:14:41.503 5453-5453/a.a.so77195407kotlinroomnotinserting W/a.a.so77195407kotlinroomnotinserting: type=1400 audit(0.0:2557): avc: denied { write } for comm=656374696F6E207072696D6172795D name="perfd" dev="dm-1" ino=36658 scontext=u:r:untrusted_app:s0:c229,c258,c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
2023-09-29 10:14:41.610 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:29 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:41.615 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:30 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:41.688 5453-5592/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection)
2023-09-29 10:14:41.703 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:31 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:41.803 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:32 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:41.985 5453-5592/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
2023-09-29 10:14:41.998 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/AlarmManager
2023-09-29 10:14:42.099 5453-5590/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: java/net/URL
2023-09-29 10:14:42.264 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/AlarmManager
2023-09-29 10:14:42.307 5453-5592/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
2023-09-29 10:14:42.495 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/AlarmManager
2023-09-29 10:14:42.502 5453-5591/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: FAILURE TO RETRANFORM Modification of Interface classes is currently not supported
2023-09-29 10:14:42.502 5453-5591/a.a.so77195407kotlinroomnotinserting E/StudioTransport: JVMTI error: 79(JVMTI_ERROR_UNMODIFIABLE_CLASS) 
2023-09-29 10:14:42.703 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/PendingIntent
2023-09-29 10:14:42.967 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/PendingIntent
2023-09-29 10:14:43.140 5453-5592/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
2023-09-29 10:14:43.155 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/PendingIntent
2023-09-29 10:14:43.434 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/PendingIntent
2023-09-29 10:14:43.699 5453-5591/a.a.so77195407kotlinroomnotinserting I/chatty: uid=10741(a.a.so77195407kotlinroomnotinserting) ection primary] identical 1 line
2023-09-29 10:14:43.918 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/PendingIntent
2023-09-29 10:14:44.220 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/Instrumentation
2023-09-29 10:14:44.534 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/Instrumentation
2023-09-29 10:14:44.714 5453-5592/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
2023-09-29 10:14:44.765 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/IntentService
2023-09-29 10:14:44.958 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/ActivityThread
2023-09-29 10:14:45.258 5453-5591/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
2023-09-29 10:14:45.342 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:33 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:45.437 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:34 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:45.458 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/os/PowerManager
2023-09-29 10:14:45.530 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:35 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:45.631 5453-5564/a.a.so77195407kotlinroomnotinserting V/StudioTransport: Agent handling command (id:36 type:APP_INSPECTION) for pid:5453.
2023-09-29 10:14:45.634 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/os/PowerManager
2023-09-29 10:14:45.808 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/os/PowerManager$WakeLock
2023-09-29 10:14:45.810 5453-5591/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Class android.os.PowerManager$WakeLock failed lock verification and will run slower.
2023-09-29 10:14:45.981 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/os/PowerManager$WakeLock
2023-09-29 10:14:45.983 5453-5591/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Class android.os.PowerManager$WakeLock failed lock verification and will run slower.
2023-09-29 10:14:46.152 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/os/PowerManager$WakeLock
2023-09-29 10:14:46.154 5453-5591/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Class android.os.PowerManager$WakeLock failed lock verification and will run slower.
2023-09-29 10:14:46.319 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/os/PowerManager$WakeLock
2023-09-29 10:14:46.321 5453-5591/a.a.so77195407kotlinroomnotinserting W/oomnotinsertin: Class android.os.PowerManager$WakeLock failed lock verification and will run slower.
2023-09-29 10:14:46.499 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/JobSchedulerImpl
2023-09-29 10:14:46.674 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/JobSchedulerImpl
2023-09-29 10:14:46.851 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/job/JobServiceEngine$JobHandler
2023-09-29 10:14:47.028 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/job/JobServiceEngine$JobHandler
2023-09-29 10:14:47.201 5453-5591/a.a.so77195407kotlinroomnotinserting V/StudioProfiler: Transformed class: android/app/job/JobService

如果你通过以上搜索,你会看到有2条错误消息,但它们不影响应用程序的数据,也不影响应用程序判断能够判断数据库.它们只是你通常会学会忽略的东西(考虑到其他方面,比如应用程序被分离).

Android相关问答推荐

ENV变量在gradle进程中没有更新

关于BLE扫描工作原理的说明

属性可选的涟漪效果ItemBackEarth Borderless不适用于Android 13和更高版本

更改活动(上下文)对接收到的uri的访问权限的影响?

Jetpack Compose X.dp 性能问题?

如何正确创建可拖动的浮动视图?

Android Jetpack Compose 电视焦点恢复

Android:使用依赖项 ViewModelProviderFactory 初始化 ViewModel 的正确方法

Android Compose 为什么 Checkbox 在父对象可点击时需要 onCheckChanged?

通知使用默认语言,屏幕显示多种语言,同时通过 AppCompatDelegate 设置应用程序语言

每次在 Jetpack Compose 中调用导航

LazyColumn 单选中的状态提升. Jetpack compose

Hilt 依赖注入重复绑定错误

Android Compose:LazyColumn 和 Column with verticalScroll 的区别

对话框中的内容不可见

Android活动系统导航栏 colored颜色 ?

Android WebView 没有在第一次页面完成时从本地存储读取数据?

自定义布局忽略可组合的大小

如何增加 BottomSheetDialog 的高度以跟随垂直平移

为什么不调用嵌套片段(ViewModel)中的流集合?