- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我运行我的应用程序时,出现以下错误消息:
Unfortunately appName has stopped error
我有以下 MainActivity.java 文件:
package com.shubhammyapp1.myapp1;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;
public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b = (Button)findViewById(R.id.button1);
b.setOnClickListener((OnClickListener) this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void onClick(View arg0) {
EditText et1= (EditText)findViewById(R.id.ocinb);
EditText et2= (EditText)findViewById(R.id.ocint);
TextView tv1= (TextView) findViewById(R.id.textView1);
Double ocb=Double.parseDouble(et1.getText().toString());
Double oct=Double.parseDouble(et2.getText().toString());
Double ocr;
ocr=(ocb-oct)*0.15;
tv1.setText("The %OC is"+ocr);
}
}
/*我的activiti_main.xml*/
<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="37dp"
android:text="1.Organic Carbon" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/ocinb"
android:layout_alignRight="@+id/ocinb"
android:layout_marginRight="33dp"
android:orientation="vertical" >
</LinearLayout>
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/ocinb"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/ocinb"
android:layout_marginLeft="36dp"
android:text="B=" />
<EditText
android:id="@+id/ocinb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/ocint"
android:layout_below="@+id/textView1"
android:layout_marginTop="36dp"
android:layout_toRightOf="@+id/textView6"
android:ems="5"
android:inputType="numberSigned|numberDecimal" />
<EditText
android:id="@+id/ocint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ocinb"
android:layout_marginTop="36dp"
android:layout_toRightOf="@+id/textView6"
android:ems="5"
android:inputType="numberSigned|numberDecimal" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/ocinb"
android:layout_alignBottom="@+id/ocinb"
android:layout_alignLeft="@+id/textView1"
android:layout_marginLeft="15dp"
android:text="B=" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/ocint"
android:layout_alignBottom="@+id/ocint"
android:layout_alignLeft="@+id/textView3"
android:text="T=" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/ocint"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:onClick="show"
android:text="Result" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="55dp"
android:layout_toRightOf="@+id/textView1"
android:text="TextView" />
</RelativeLayout>
/我的 Androidmanifest.xml 文件/
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shubhammyapp1.myapp1"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
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.shubhammyapp1.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
错误日志:
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 0 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 1 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 2 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 3 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 4 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 5 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 6 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 7 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 8 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 9 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 10 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 11 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 12 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 13 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 14 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 15 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 16 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 17 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 18 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 19 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 20 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 21 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 22 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 23 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 24 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 25 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 26 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 27 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 28 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 29 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 30 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 31 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 32 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 33 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
02-14 12:07:36.783: D/dalvikvm(2415): Not late-enabling CheckJNI (already on)
02-14 12:07:37.513: D/AndroidRuntime(2415): Shutting down VM
02-14 12:07:37.513: W/dalvikvm(2415): threadid=1: thread exiting with uncaught exception (group=0x414c4700)
02-14 12:07:37.673: E/AndroidRuntime(2415): FATAL EXCEPTION: main
02-14 12:07:37.673: E/AndroidRuntime(2415): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.shubhammyapp1.myapp1/com.shubhammyapp1.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.shubhammyapp1.MainActivity" on path: DexPathList[[zip file "/data/app/com.shubhammyapp1.myapp1-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.shubhammyapp1.myapp1-2, /system/lib]]
02-14 12:07:37.673: E/AndroidRuntime(2415): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
02-14 12:07:37.673: E/AndroidRuntime(2415): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
02-14 12:07:37.673: E/AndroidRuntime(2415): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-14 12:07:37.673: E/AndroidRuntime(2415): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
02-14 12:07:37.673: E/AndroidRuntime(2415): at android.os.Handler.dispatchMessage(Handler.java:99)
02-14 12:07:37.673: E/AndroidRuntime(2415): at android.os.Looper.loop(Looper.java:137)
02-14 12:07:37.673: E/AndroidRuntime(2415): at android.app.ActivityThread.main(ActivityThread.java:5103)
02-14 12:07:37.673: E/AndroidRuntime(2415): at java.lang.reflect.Method.invokeNative(Native Method)
02-14 12:07:37.673: E/AndroidRuntime(2415): at java.lang.reflect.Method.invoke(Method.java:525)
02-14 12:07:37.673: E/AndroidRuntime(2415): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
02-14 12:07:37.673: E/AndroidRuntime(2415): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-14 12:07:37.673: E/AndroidRuntime(2415): at dalvik.system.NativeStart.main(Native Method)
02-14 12:07:37.673: E/AndroidRuntime(2415): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.shubhammyapp1.MainActivity" on path: DexPathList[[zip file "/data/app/com.shubhammyapp1.myapp1-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.shubhammyapp1.myapp1-2, /system/lib]]
02-14 12:07:37.673: E/AndroidRuntime(2415): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
02-14 12:07:37.673: E/AndroidRuntime(2415): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-14 12:07:37.673: E/AndroidRuntime(2415): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-14 12:07:37.673: E/AndroidRuntime(2415): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
02-14 12:07:37.673: E/AndroidRuntime(2415): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
02-14 12:07:37.673: E/AndroidRuntime(2415): ... 11 more
最佳答案
我看到很多可能导致错误的事情,因此您应该发布您的 logcat,以便我们知道导致错误的原因。但是,我发现有一件事肯定会导致错误。你有
android:onClick="show"
用于 xml 中的 Button
。您将得到 MethodNotFoundException
,我相信是这样,因为您的代码中没有名为 show(View view)
的方法。如果您这样做,则无需以编程方式设置 OnClickListener
。
删除 onClick()
函数和 b.setOnClickListener((OnClickListener) this);
并添加一个类似的方法
public void show(View v)
{
// your code for button click here
}
这在 Button Docs 中有解释。
此外,解析时还应该进行一些错误检查。例如,这些行
Double ocb=Double.parseDouble(et1.getText().toString());
应该被 try/catch
包围,或者有一些其他的错误检查,如果你还没有做一些事情,以防用户输入无效字符,例如字母或什么都没有全部。
关于java - 当我启动 apk 文件时出现以下错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21924236/
这个问题在这里已经有了答案: standalone parentheses in javascript [duplicate] (5 个答案) 关闭 8 年前。 我在学习JavaScript,有时会
我是mysql新手,我必须减少以下更新查询的执行时间 UPDATE temp_countcalculations, ( SELECT count(*) as insuffcounts,CRP_
def escape_html(s): for (i, o) in (("&","&"),(">", ">"),(" "变成 ">"等。 关于python - 以下 for 循环
if (read(read(cin, data1), data2)) 问题是C++ Primer 5th Edition 的练习。 read 函数定义如下: std::istream &read(st
我想创建两个宏。其中一个将扩展到函数原型(prototype)和函数内容,另一个将扩展到仅函数原型(prototype)。我正在考虑创建以下内容: #ifdef SOME_CONDITION #def
我正在使用 jongo API - org.jongo.MongoCollection 是类。 我有对象 ID 列表并转换为与 ObjectId[] 相同并尝试按如下方式查询 collection.f
有人可以解释以下正则表达式匹配什么吗? ^.*$ 谢谢! 最佳答案 或者整个字符串或者整行,取决于是否multiline mode被使用。 关于java - 以下 ^.*$ 正则表达式匹配什么?,我们
#include void main() { int a,b,c; for(b = c = 10; a = "- FIGURE?, UMKC,XYZHello Folks,TFy!QJ
我的代码段中的以下代码行被 Sonar 检测为问题。 代码段: final int Pending=1; Sonar 问题: Name 'Pending' must matc
Print name of all activities with neither maximum nor minimum number of participants 我尝试了以下查询,但出现错误:
这个问题在这里已经有了答案: What is this practice called in JavaScript? (7 个回答) 关闭8年前。 (function() { //do stuff
根据任务,我们必须通过 foldr 实现 foldl。通过比较函数签名和 foldl 实现,我得到了以下解决方案: myFoldl :: (a -> b -> a) -> a -> [b] -> a
这个问题在这里已经有了答案: Export an es6 default class inline with definition or at end of file? (1 个回答) 关闭 2 年
据我了解,以下是相同的: Person p{}; // Case 1 Person p = {}; // Case 1.5 我注意到 Person p = Person{}; // Case 2 产生
below i have given a javascript code picture `` can any one help me in this code. what do this code.
我想在标题和正文上搜索全文,并在答案计数上进行过滤。 我阅读了elasticsearch documentation for combining filters并构建了此查询。 "query": {
它是流动的 C 代码中的内存泄漏吗? #include int *a; int main() { a = malloc(sizeof(int)*10); return
这两个声明有什么区别: char (*ptr)[N]; 对比 char ptr[][N]; 谢谢。 最佳答案 (1)声明 char (*ptr)[N]; ptr 是指向大小为 N 的字符数组的指针 下
data II = I Int Int deriving (Show) instance II Show where show I a b = show (a+b) showt.hs:3:2: s
我从 clojuredoc 中阅读了关于 condp 的文档。在文档中我找到了以下代码: (condp 一些 [1 2 3 4] #{0 6 7} :>> 公司 #{4 5 9} :>> 十二月 #{
我是一名优秀的程序员,十分优秀!