2016-11-25 3 views
-1

アクティビティを開始できませんでした。コンポーネント情報」です。私はstart_salud関数を呼び出すときStartActivitity()Android Appsでクラッシュする

public void start_salud(View view) { 
     Intent intent = new Intent(MainActivity.this, salud.class); 
     startActivity(intent); 
    } 

をそれは私がandroid:onClick="start_salud"から呼び出すstartActivity(intent)

にクラッシュします。

salud_class:

package com.alertavecino.alertavecino; 

import android.os.Bundle; 
import android.support.v7.app.AppCompatActivity; 
import android.widget.ListView; 

import java.util.ArrayList; 

public class salud extends AppCompatActivity { 
    ArrayList<String> listDiseases; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.salud_layout); 
    } 
} 

ダビング結果:

 if (mResolvedMethod == null) {  // <-- This statment is true 
      resolveMethod(mHostView.getContext(), mMethodName); 
     } 

     try { 
      mResolvedMethod.invoke(mResolvedContext, v); // <-- Here it's crashes 
     } catch (IllegalAccessException e) { 
      throw new IllegalStateException(
        "Could not execute non-public method for android:onClick", e); 
     } catch (InvocationTargetException e) { 
      throw new IllegalStateException(
        "Could not execute method for android:onClick", e); 
     } 

たManifest.xml:

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

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="Alerta Vecino!" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     <activity android:name=".MainActivity"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

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

</manifest> 

猫ログ:

11-25 20:17:31.924 29226から29226/E /接合子com.alertavecino.alertavecino:MountEmulatedStorage() 11-25 20:17:31.924 29226から29226/com.alertavecino .alertavecino E /接合子:V2 11-25 20:17:31.944 29226から29226/com.alertavecino.alertavecino E/SELinuxの:[DEBUG] GET_CATEGORY:変数seinfo:デフォルト感度:NULL、cateogry:NULL

+1

クラッシュログを投稿してください – Jon

+1

LogCatを投稿して –

+0

マニフェストを投稿できますか?容疑者。 –

答えて

0

マニフェストを開始できるようにするには、マニフェストでアクティビティを宣言する必要があります。

<application>タグ内部のあなたのManifest.xmlファイルに以下を追加します。

<activity android:name=".salud"> 
    <intent-filter> 
     <category android:name="android.intent.category.LAUNCHER" /> 
     <action android:name="android.intent.action.MAIN" /> 
    </intent-filter> 
</activity> 

これはあなたの活動を開始することができ、また、デバイスのアプリのリストからアクティビティが起動可能になります。

0

マニフェストにすべてのアクティビティを登録する必要があります。

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

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="Alerta Vecino!" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     <activity android:name=".MainActivity"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

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

</manifest> 

チェックthis linkおよびofficial docs

関連する問題