dimanche 10 mai 2015

Unfortunately, “App Name” has stopped. (Genymotion Emulator, Eclipse)

when i try to launch my app on genymotion , it does not open. im new to android programming. Help me please..thank you it show me Unfortunately “App Name” has stopped.

here is my Androidmanifest.xml :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://ift.tt/nIICcg"
    package="com.flameanime.pieceonebestquotes"
    android:installLocation="internalOnly"
    android:versionCode="3"
    android:versionName="1.6" >

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="18" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Black.NoTitleBar" >
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <activity
            android:name="com.flameanime.pieceonebestquote.SplashActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.flameanime.pieceonebestquote.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="com.engahmedphp.successquotes.MainActivity"
                    android:scheme="oauth" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.flameanime.pieceonebestquote.QuotesActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.flameanime.pieceonebestquote.AuthorsActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden" >
        </activity>
        <activity
            android:name="com.flameanime.pieceonebestquote.SettingsActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:host="com.engahmedphp.successquotes.SettingsActivity"
                    android:scheme="oauth" />
            </intent-filter>
        </activity>
        <!-- android:launchMode="singleTask" -->
        <activity
            android:name="com.flameanime.pieceonebestquote.AboutActivity"
            android:hardwareAccelerated="false"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Black" >
        </activity>
        <activity
            android:name="com.flameanime.pieceonebestquote.QuoteDialogActivity"
            android:configChanges="orientation|keyboardHidden"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Dialog" >
        </activity>
        <activity
            android:name="com.flameanime.pieceonebestquote.QuickActionActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>

        <receiver android:name="com.flameanime.pieceonebestquote.AlarmReceiver" >
        </receiver>
        <receiver
            android:name="com.flameanime.pieceonebestquote.BootCompletedReceiver"
            android:enabled="true"
            android:exported="true"
            android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
                <action android:name="android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>

        <activity
            android:name="com.flameanime.pieceonebestquote.UpdatesDialogActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Dialog" >
        </activity>

        <service android:name="com.flameanime.pieceonebestquote.ResetAlarmsService" >
        </service>
        <service android:name="com.flameanime.pieceonebestquote.GetUpdatesService" >
        </service>
        <service android:name="com.flameanime.pieceonebestquote.CheckUpdatesService" >
        </service>

        <activity
            android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
        <activity
            android:name="com.facebook.LoginActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/app_id" />
    </application>

</manifest>

and here is my mainactivity.java

package com.flameanime.pieceonebestquote;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import com.flameanime.pieceonebestquotes.R;

import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;

public class MainActivity extends Activity {

        SharedPreferences mSharedPreferences;
        String qotdId;
        
        DAO db;

        String siteUrl, updatesUrl;
        int lastAuthor, lastQuote;
        
        private ConnectionDetector cd;
        
        // ==============================================================================
        
        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_main);

                db = new DAO(this);
                db.open();
                
                cd = new ConnectionDetector(MainActivity.this);
                
                if (cd.isConnectingToInternet()) {
                        // Internet Connection is not present

                        Intent checkUpdates = new Intent(MainActivity.this, CheckUpdatesService.class);

                        startService(checkUpdates);
                }
                
                generateKeyHash();

                final ImageButton quotes = (ImageButton) findViewById(R.id.quotes);
                quotes.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View v) {
                                Intent intent = new Intent(MainActivity.this,
                                                QuotesActivity.class);
                                intent.putExtra("quotesType", 1);
                                intent.putExtra("itemSelected", 0);
                                startActivity(intent);
                        }
                });

                final ImageButton authors = (ImageButton) findViewById(R.id.authors);
                authors.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View v) {
                                Intent intent = new Intent(MainActivity.this,
                                                AuthorsActivity.class);
                                startActivity(intent);
                        }
                });

                final ImageButton favorites = (ImageButton) findViewById(R.id.favorites);
                favorites.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View v) {
                                Intent intent = new Intent(MainActivity.this,
                                                QuotesActivity.class);
                                intent.putExtra("quotesType", 2);
                                startActivity(intent);
                        }
                });

                final ImageButton settings = (ImageButton) findViewById(R.id.settings);
                settings.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View v) {
                                Intent intent = new Intent(MainActivity.this,
                                                SettingsActivity.class);
                                startActivity(intent);
                        }
                });

                final ImageButton qotd = (ImageButton) findViewById(R.id.qotd);
                qotd.setOnClickListener(new View.OnClickListener() {
                        public void onClick(View v) {
                                Intent intent = new Intent(MainActivity.this,
                                                QuoteDialogActivity.class);
                                intent.putExtra("isQOTD", 1);
                                startActivity(intent);
                        }
                });

                mSharedPreferences = getApplicationContext().getSharedPreferences(
                                "MyPref", 0);
                Editor editor = mSharedPreferences.edit();

                if (mSharedPreferences.getString("QOTD", null) == null) {

//                      Random random = new Random();
//                      Log.e("count", db.getQuotesCount().toString());
                        
//                      int idNumber = random.nextInt(db.getQuotesCount() - 1 + 1) + 1;
                        
                        int idNumber = db.getQotdId();
                        qotdId = String.valueOf(idNumber);
//                      Log.e("count1111", qotdId);
                        editor.putString("QOTD", qotdId);

                        Intent alarmIntent = new Intent(MainActivity.this,
                                        AlarmReceiver.class);
                        PendingIntent pendingIntent = PendingIntent.getBroadcast(
                                        getApplicationContext(), 0, alarmIntent, 0);

                        AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);

                        Editor e = mSharedPreferences.edit();
                        Long time = System.currentTimeMillis() + (24 * 60 * 60 * 1000);
                        e.putLong("alarmTime", time);
                        e.commit(); // save changes

                        alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, time,
                                        24 * 60 * 60 * 1000, pendingIntent);

                }

                editor.commit();

        }

        // ==============================================================================
        
        private void generateKeyHash() {
                PackageInfo packageInfo;

                try {

                        packageInfo = getPackageManager().getPackageInfo("com.engahmedphp.successquotes",

                        PackageManager.GET_SIGNATURES);

                        for (Signature signature : packageInfo.signatures) {

                                MessageDigest md = MessageDigest.getInstance("SHA");

                                md.update(signature.toByteArray());

                                String key = new String(Base64.encode(md.digest(), 0));

                                // String key = new String(Base64.encodeBytes(md.digest()));

                                Log.e("Hash key", key);

                        }

                }

                catch (NameNotFoundException e1) {

                        Log.e("Name not found", e1.toString());

                }

                catch (NoSuchAlgorithmException e) {

                        Log.e("No such an algorithm", e.toString());

                }

                catch (Exception e) {

                        Log.e("Exception", e.toString());

                }
        }

}

and here is my logcat

05-10 06:24:08.195: D/dalvikvm(1472): GC_FOR_ALLOC freed 41K, 1% free 8834K/8904K, paused 54ms, total 58ms
05-10 06:24:08.255: I/dalvikvm-heap(1472): Grow heap (frag case) to 12.203MB for 3723612-byte allocation
05-10 06:24:08.291: D/dalvikvm(1472): GC_FOR_ALLOC freed <1K, 1% free 12471K/12544K, paused 37ms, total 37ms
05-10 06:24:08.347: D/dalvikvm(1472): GC_FOR_ALLOC freed <1K, 1% free 12471K/12544K, paused 6ms, total 6ms
05-10 06:24:08.443: I/dalvikvm-heap(1472): Grow heap (frag case) to 18.518MB for 6622028-byte allocation
05-10 06:24:08.483: D/dalvikvm(1472): GC_FOR_ALLOC freed <1K, 1% free 18937K/19012K, paused 39ms, total 39ms
05-10 06:24:08.627: E/path(1472): /data/data/com.flameanime.onepiecebestquotes/databases/SuccessQuotes
05-10 06:24:08.651: W/System.err(1472): java.net.MalformedURLException
05-10 06:24:08.651: W/System.err(1472):         at java.net.URL.<init>(URL.java:154)
05-10 06:24:08.651: W/System.err(1472):         at java.net.URL.<init>(URL.java:127)
05-10 06:24:08.651: W/System.err(1472):         at com.flameanime.onepiecebestquote.JSONParser.getJSONFromUrl(JSONParser.java:44)
05-10 06:24:08.651: W/System.err(1472):         at com.flameanime.onepiecebestquote.CheckUpdatesService.checkUpdates(CheckUpdatesService.java:88)
05-10 06:24:08.651: W/System.err(1472):         at com.flameanime.onepiecebestquote.CheckUpdatesService.onHandleIntent(CheckUpdatesService.java:52)
05-10 06:24:08.651: W/System.err(1472):         at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
05-10 06:24:08.651: W/System.err(1472):         at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 06:24:08.651: W/System.err(1472):         at android.os.Looper.loop(Looper.java:137)
05-10 06:24:08.651: W/System.err(1472):         at android.os.HandlerThread.run(HandlerThread.java:61)
05-10 06:24:08.707: D/libEGL(1472): loaded /system/lib/egl/libEGL_genymotion.so
05-10 06:24:08.719: D/(1472): HostConnection::get() New Host Connection established 0xb965fb48, tid 1472
05-10 06:24:08.727: D/libEGL(1472): loaded /system/lib/egl/libGLESv1_CM_genymotion.so
05-10 06:24:08.731: D/libEGL(1472): loaded /system/lib/egl/libGLESv2_genymotion.so
05-10 06:24:08.859: W/EGL_genymotion(1472): eglSurfaceAttrib not implemented
05-10 06:24:08.859: E/OpenGLRenderer(1472): Getting MAX_TEXTURE_SIZE from GradienCache
05-10 06:24:08.883: E/OpenGLRenderer(1472): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
05-10 06:24:08.887: D/OpenGLRenderer(1472): Enabling debug mode 0
05-10 06:24:08.887: E/destroy service(1472): destroy
05-10 06:24:10.939: D/dalvikvm(1472): GC_FOR_ALLOC freed 3658K, 20% free 15340K/19028K, paused 8ms, total 8ms
05-10 06:24:10.939: I/dalvikvm-heap(1472): Grow heap (frag case) to 18.555MB for 3723612-byte allocation
05-10 06:24:10.991: D/dalvikvm(1472): GC_FOR_ALLOC freed 2K, 1% free 18973K/19028K, paused 10ms, total 10ms
05-10 06:24:10.999: D/dalvikvm(1472): GC_FOR_ALLOC freed 1K, 1% free 18971K/19028K, paused 8ms, total 8ms
05-10 06:24:11.075: I/dalvikvm-heap(1472): Grow heap (frag case) to 24.867MB for 6622028-byte allocation
05-10 06:24:11.159: D/dalvikvm(1472): GC_FOR_ALLOC freed 0K, 1% free 25438K/25496K, paused 11ms, total 11ms
05-10 06:24:11.299: E/path(1472): /data/data/com.flameanime.onepiecebestquotes/databases/SuccessQuotes
05-10 06:24:11.315: E/Name not found(1472): android.content.pm.PackageManager$NameNotFoundException: com.engahmedphp.successquotes
05-10 06:24:11.319: E/SQLiteLog(1472): (1) no such table: quotes
05-10 06:24:11.319: D/AndroidRuntime(1472): Shutting down VM
05-10 06:24:11.319: W/dalvikvm(1472): threadid=1: thread exiting with uncaught exception (group=0xa4c43648)
05-10 06:24:11.327: E/AndroidRuntime(1472): FATAL EXCEPTION: main
05-10 06:24:11.327: E/AndroidRuntime(1472): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.flameanime.onepiecebestquotes/com.flameanime.onepiecebestquote.MainActivity}: android.database.sqlite.SQLiteException: no such table: quotes (code 1): , while compiling: SELECT _quid FROM quotes ORDER BY RANDOM() LIMIT 1
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.os.Looper.loop(Looper.java:137)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.app.ActivityThread.main(ActivityThread.java:5103)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at java.lang.reflect.Method.invokeNative(Native Method)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at java.lang.reflect.Method.invoke(Method.java:525)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at dalvik.system.NativeStart.main(Native Method)
05-10 06:24:11.327: E/AndroidRuntime(1472): Caused by: android.database.sqlite.SQLiteException: no such table: quotes (code 1): , while compiling: SELECT _quid FROM quotes ORDER BY RANDOM() LIMIT 1
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1253)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at com.flameanime.onepiecebestquote.DAO.getQotdId(DAO.java:185)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at com.flameanime.onepiecebestquote.MainActivity.onCreate(MainActivity.java:118)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.app.Activity.performCreate(Activity.java:5133)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-10 06:24:11.327: E/AndroidRuntime(1472):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
05-10 06:24:11.327: E/AndroidRuntime(1472):     ... 11 more
05-10 06:24:16.671: I/Process(1472): Sending signal. PID: 1472 SIG: 9
05-10 06:24:27.711: W/System.err(1491): java.net.MalformedURLException
05-10 06:24:27.711: W/System.err(1491):         at java.net.URL.<init>(URL.java:154)
05-10 06:24:27.711: W/System.err(1491):         at java.net.URL.<init>(URL.java:127)
05-10 06:24:27.715: W/System.err(1491):         at com.flameanime.onepiecebestquote.JSONParser.getJSONFromUrl(JSONParser.java:44)
05-10 06:24:27.715: W/System.err(1491):         at com.flameanime.onepiecebestquote.CheckUpdatesService.checkUpdates(CheckUpdatesService.java:88)
05-10 06:24:27.715: W/System.err(1491):         at com.flameanime.onepiecebestquote.CheckUpdatesService.onHandleIntent(CheckUpdatesService.java:52)
05-10 06:24:27.715: W/System.err(1491):         at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
05-10 06:24:27.715: W/System.err(1491):         at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 06:24:27.715: W/System.err(1491):         at android.os.Looper.loop(Looper.java:137)
05-10 06:24:27.715: W/System.err(1491):         at android.os.HandlerThread.run(HandlerThread.java:61)
05-10 06:24:27.731: E/destroy service(1491): destroy

please help me i really appreciate it

Aucun commentaire:

Enregistrer un commentaire