Java 不幸的是,myandroidapps已经停止了
我对android应用程序开发非常陌生。我成功地签署了我的应用程序并安装在我的手机Android版本上。4.1.2. 下面的代码是我的代码。我能知道怎么了吗?谢谢大家:) 活动\u main.xmlJava 不幸的是,myandroidapps已经停止了,java,android,Java,Android,我对android应用程序开发非常陌生。我成功地签署了我的应用程序并安装在我的手机Android版本上。4.1.2. 下面的代码是我的代码。我能知道怎么了吗?谢谢大家:) 活动\u main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://sch
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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:id="@+id/relativeLayout1"
>
<Button
android:id="@+id/buttonFlashlight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:text="Torch" /> </RelativeLayout>
myandroidapps清单
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mkyong.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" android:allowBackup="false">
<activity
android:label="@string/app_name"
android:name=".FlashLightActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </manifest>
您忘记在
AndroidManifest.xml
中声明MainActivity
活动。将其添加为:
....
<activity android:name=".MainActivity" />
....
</application>
....
。。。。
....
....
发布您的LogCat…以便我们可以帮助您。我尝试了LogCat,但它不起作用。我的应用程序打开,然后整个屏幕变黑。然后,错误“不幸的是myandroidapps已停止”。LogCat上没有显示任何内容,此时您肯定会在LogCat中看到一些内容!请确保没有过滤器集。您应该看到一些东西。eclipse中的logcat查看器有时会出现问题。要获取logcat,请转到命令提示符,并发出“adb logcat”命令,然后将输出重定向到文件。然后检查可能引发的异常,并在此处发布相关部分。大家好,不工作。我将AndroidManifest.xml中的.FlashLightActivity更改为以下代码:
....
<activity android:name=".MainActivity" />
....
</application>
....