0

我是 android 开发人员的新手。我正在关注http://developer.android.com/training/basics/firstapp/building-ui.html。当我第一次在模拟器上运行简单的 hello world 应用程序时。现在我正在尝试运行下一个应用程序。应用程序未安装在模拟器上,即模拟器没有显示应用程序名称和应用程序图标。然后我从包资源管理器中删除了两个应用程序并重新启动笔记本电脑。然后我再次创建第二个应用程序并尝试安装在 emulator.Emulator 上再次没有显示应用程序。然后我尝试在模拟器上安装 hello world 应用程序,这也不起作用。我检查了最小值。android manifest.xml 中的 sdk 版本和目标 sdk 版本都是正确的。Hello 是第二个应用程序的项目名称。

控制台正在显示

[2012-12-28 21:23:21 - Hello] ------------------------------
[2012-12-28 21:23:21 - Hello] Android Launch!
[2012-12-28 21:23:21 - Hello] adb is running normally.
[2012-12-28 21:23:21 - Hello] Performing com.example.hello.MainActivity activity launch
[2012-12-28 21:23:21 - Hello] Automatic Target Mode: launching new emulator with compatible AVD 'Froyo'
[2012-12-28 21:23:21 - Hello] Launching a new emulator with Virtual Device 'Froyo'
[2012-12-28 21:23:21 - Emulator] Failed to load libGL.so
[2012-12-28 21:23:21 - Emulator] error libGL.so: cannot open shared object file: No such file or directory
[2012-12-28 21:23:21 - Emulator] Failed to load libGL.so
[2012-12-28 21:23:21 - Emulator] error libGL.so: cannot open shared object file: No such file or directory
[2012-12-28 21:23:21 - Emulator] emulator: emulator window was out of view and was recentered
[2012-12-28 21:23:21 - Emulator] 
[2012-12-28 21:23:21 - Hello] New emulator found: emulator-5554
[2012-12-28 21:23:21 - Hello] Waiting for HOME ('android.process.acore') to be launched...
[2012-12-28 21:23:28 - Hello] emulator-5554 disconnected! Cancelling 'com.example.hello.MainActivity activity launch'!
[2012-12-28 21:23:43 - Hello] ------------------------------
[2012-12-28 21:23:43 - Hello] Android Launch!
[2012-12-28 21:23:43 - Hello] adb is running normally.
[2012-12-28 21:23:43 - Hello] Performing com.example.hello.MainActivity activity launch
[2012-12-28 21:23:44 - Hello] Automatic Target Mode: launching new emulator with compatible AVD 'Froyo'
[2012-12-28 21:23:44 - Hello] Launching a new emulator with Virtual Device 'Froyo'
[2012-12-28 21:23:45 - Emulator] Failed to load libGL.so
[2012-12-28 21:23:45 - Emulator] error libGL.so: cannot open shared object file: No such file or directory
[2012-12-28 21:23:45 - Emulator] Failed to load libGL.so
[2012-12-28 21:23:45 - Emulator] error libGL.so: cannot open shared object file: No such file or directory
[2012-12-28 21:23:45 - Emulator] emulator: emulator window was out of view and was recentered
[2012-12-28 21:23:45 - Emulator] 
[2012-12-28 21:23:45 - Hello] New emulator found: emulator-5554
[2012-12-28 21:23:45 - Hello] Waiting for HOME ('android.process.acore') to be launched...
[2012-12-28 21:23:59 - Hello] emulator-5554 disconnected! Cancelling 'com.example.hello.MainActivity activity launch'!

activity_mail.xml 的代码是

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<EditText android:id="@+id/edit_message"
    android:layout_weight="1"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:hint="@string/edit_message"
    />

<Button android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_send"/>

 </LinearLayout>

string.xml 的代码是

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">My First App</string>
<string name="edit_message">Enter a message</string>
<string name="button_send">Send</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_main">MainActivity</string>
</resources>

安装 libGL.so 后控制台不显示 Failed to load libGL.so [2012-12-28 21:23:45 - Emulator] 错误 libGL.so:无法打开共享对象文件:没有这样的文件或目录 [2012-12 -28 21:23:45 - Emulator] Failed to load libGL.so [2012-12-28 21:23:45 - Emulator] error libGL.so: cannot open shared object file: No such file or directory but still application won ,t 安装在模拟器上。

这是 hello 应用程序的 androidmanifest.xml 文件

 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.second"
  android:versionCode="1"
   android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.second.Second"
        android:label="@string/app_name" android:icon="@drawable/ic_launcher"                android:theme="@style/AppBaseTheme" android:showOnLockScreen="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

带着敬意

杰伊

4

2 回答 2

1

看起来您正在 Linux 上进行开发。您需要将一个工作 libGL.so 符号链接到您的 32 位 lib 目录中。这可以像“sudo ln -s /usr/lib/libGL.so.1 /usr/lib/libGL.so”一样简单。

于 2012-12-27T16:16:47.053 回答
0

libGL.so 属于 Mesa libGL 运行时库。模拟器抱怨,因为它找不到 32 位 Mesa 库。为 i386 / i686 架构安装 Mesa:

于 2012-12-27T16:19:21.803 回答