Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6702459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:03:24+00:00 2026-05-26T07:03:24+00:00

Okay, now i’m really stuck here. I don’t know what to do, where to

  • 0

Okay, now i’m really stuck here. I don’t know what to do, where to go or ANYTHING!

I have been trying to uninstall, reinstall, both SDK and Eclipse-versions, trying to Google this out, but nu-uh… Nothing!!!

I CAN run my app in emulator, but i cant EXPORT it…

[2011-10-07 16:35:30 – Dex Loader] Unable to execute dex: Multiple dex files define Lcom/dreamhawk/kalori/DataBaseHelper;

this is dataBaseHelper

package com.dreamhawk.kalori;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import android.widget.Toast;



public class DataBaseHelper extends SQLiteOpenHelper {

    // The Android's default system path of your application database.
    private static String DB_PATH = "/data/data/com.dreamhawk.kalori/databases/";

    private static String DB_NAME = "livsmedel_db";
    private DataBaseHelper myDBHelper;
    private SQLiteDatabase myDb;

    private final Context myContext;

    private static final String DATABASE_TABLE = "Livsmedel";
    public static String DB_FILEPATH = "/data/data/com.dreamhawk.kalori/databases/lifemedel_db";
    public static final String KEY_TITLE = "Namn";
    public static final String KEY_BODY = "Kcal";
    public static final String KEY_ROWID = "_id";
    private static final int DATABASE_VERSION = 2;

    /**
     * Constructor Takes and keeps a reference of the passed context in order to
     * access to the application assets and resources.
     * 
     * @param context
     */
    public DataBaseHelper(Context context) {

        super(context, DB_NAME, null, 1);
        this.myContext = context;

        // checking database and open it if exists
        if (checkDataBase()) {
            openDataBase();
        } else {
            try {
                this.getReadableDatabase();
                createDatabase();
                this.close();
                openDataBase();

            } catch (IOException e) {
                throw new Error("Error copying database");
            }
            Toast.makeText(context, "Livsmedelsdatabasen importerad",
                    Toast.LENGTH_LONG).show();
        }

    }

    private boolean checkDataBase() {
        SQLiteDatabase checkDB = null;
        boolean exist = false;
        try {
            String dbPath = DB_PATH + DB_NAME;
            checkDB = SQLiteDatabase.openDatabase(dbPath, null,
                    SQLiteDatabase.OPEN_READONLY);
        } catch (SQLiteException e) {
            Log.v("db log", "database does't exist");
        }

        if (checkDB != null) {
            exist = true;
            checkDB.close();
        }
        return exist;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        // db.execSQL(DATABASE_CREATE);
    }

     @Override
     public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

           Log.w("Kalori", "Upgrading database from version " + oldVersion + " to "
               + newVersion + ", which will destroy all old data");
           db.execSQL("DROP TABLE IF EXISTS Livsmedel");
           onCreate(db);

       }

    public DataBaseHelper open() throws SQLException {
        myDBHelper = new DataBaseHelper(myContext);
        myDb = myDBHelper.getWritableDatabase();
        return this;
    }

    public void createDatabase() throws IOException {

        InputStream assetsDB = myContext.getAssets().open("livsmedel_db");
        // OutputStream dbOut = new FileOutputStream(DB_PATH);
        String outFileName = DB_PATH + DB_NAME;
        OutputStream dbOut = new FileOutputStream(outFileName);

        Log.d("DH", "index=" + assetsDB);
        byte[] buffer = new byte[1024];
        int length;
        while ((length = assetsDB.read(buffer)) > 0) {
            dbOut.write(buffer, 0, length);
        }

        dbOut.flush();
        dbOut.close();
        assetsDB.close();
    }

    public Cursor fetchAllNotes() {

        return myDb.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_TITLE,
                KEY_BODY }, null, null, null, null, null);
    }

    public void openDataBase() throws SQLException {
        String dbPath = DB_PATH + DB_NAME;
        myDb = SQLiteDatabase.openDatabase(dbPath, null,
                SQLiteDatabase.OPEN_READWRITE);
    }

}

I suspect:

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

But I don’t know what to do… Please help !!! :'(

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:03:24+00:00Added an answer on May 26, 2026 at 7:03 am

    I updated eclipse (Help->Check for updates) today (21st October,2011) and now I don’t see the error. Before it I had error “Unable to execute dex: Multiple dex files define“. Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay. Now I give up. I have been playing with this for hours. I
Okay, Here is what I'm trying to do... Right now it is compiling but
Okay... I've been wrestling this error for at least an hour now. I have
first, I can't stand Crystal! Okay, that's off my chest... Now, we have an
Okay right now I have too include the code below on every single page
Okay so I split my access database, and now I have a backend: If
Okay, Now admittedly this sounds like a silly question; But, I actually have a
Okay, I'll say now that I know very little about Java. I was given
Okay, so right now I'm trying to call an Ajax function from a normal
Okay, so I've been using JQuery for a while now, I'm in the process

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.