You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio真机运行应用提示libmigui.so库未找到问题求助

问题

真机运行Android应用时出现libmigui.so找不到的错误,应用启动后显示空白界面;模拟器无报错但同样显示空白。

错误日志

E/e.tipcalculato: open libmigui.so failed! dlopen - dlopen failed: library "libmigui.so" not found

项目代码

package com.example.tipcalculator

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CornerSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.example.tipcalculator.ui.theme.TipCalculatorTheme
import com.example.tipcalculator.MyApp as MyApp

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            MyApp {
                TopHeader()
            }
        }
    }
}

@Composable
fun MyApp(content: @Composable () -> Unit) {
    TipCalculatorTheme {

        Surface(
            color = MaterialTheme.colors.background,
        ) {

        }
    }
}

@Preview
@Composable
fun TopHeader(totalPerPerson: Double = 134.0) {
    Surface(
        modifier = Modifier
            .fillMaxWidth()
            .height(150.dp)
            .clip(shape = RoundedCornerShape(corner = CornerSize(12.dp))),
        color = Color(0xDAF0A6E5)
    ) {
        Column(
            modifier = Modifier.padding(12.dp), verticalArrangement = Arrangement.Center,
            horizontalAlignment = Alignment.CenterHorizontally
        ) {
            val total = "%.2f".format(totalPerPerson)
            Text(text = "Total per person", style = MaterialTheme.typography.h5)
            Text(
                text = "$$total",
                style = MaterialTheme.typography.h4,
                fontWeight = FontWeight.ExtraBold
            )
        }

    }
}

已尝试操作

  • 重启设备和Android Studio
  • 清理并重建项目
  • 检查API版本

解决方案

1. 修复空白界面问题

空白界面的核心原因是MyApp组件未调用传入的content参数,导致TopHeader从未被渲染。修改MyApp代码:

@Composable
fun MyApp(content: @Composable () -> Unit) {
    TipCalculatorTheme {
        Surface(
            color = MaterialTheme.colors.background,
        ) {
            content() // 添加此行,渲染传入的TopHeader
        }
    }
}

2. 解决libmigui.so找不到的错误

该错误与魅族设备系统特性相关(libmigui.so是魅族系统专属库),可尝试以下方法:

  • 在AndroidManifest.xml的<application>标签内添加:
    <meta-data
        android:name="android.hardware.microphone"
        android:value="false" />
    
  • 检查项目依赖,移除不必要的魅族相关第三方库
  • 升级Android Gradle Plugin和Gradle至最新稳定版
  • 若使用魅族设备,尝试将系统更新至最新版本

内容的提问来源于stack exchange,提问作者Slaw

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 01:25:16