The database is created on the emulator and on another device (HTC API 10). I can add entries to the table, read and delete them. On the Meizu M3 note device it is impossible to create, an error appears in the logs.

03-08 12:38:56.506 5161-5161/com.example.opimand.simplesqlite E/System: stat file error, path is /data/app/com.example.opimand.simplesqlite-2/lib/arm64, exception is android.system.ErrnoException: stat failed: ENOENT (No such file or directory) 03-08 12:38:57.448 5161-5215/com.example.opimand.simplesqlite E/GED: Failed to get GED Log Buf, err(0) [ 03-08 12:38:57.448 5161: 5215 I/ ] elapse(include ctx switch):3792 (ms), eglInitialize 

Here is the program code

 package com.example.opimand.simplesqlite; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity implements View.OnClickListener{ final String LOG_TAG = "myLogs"; Button btnAdd, btnRead, btnClear; EditText etName, etEmail; DBHelper dBhelper; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnAdd = (Button) findViewById(R.id.btnAdd); btnAdd.setOnClickListener(this); btnRead = (Button) findViewById(R.id.btnRead); btnRead.setOnClickListener(this); btnClear = (Button) findViewById(R.id.btnClear); btnClear.setOnClickListener(this); etName = (EditText) findViewById(R.id.etName); etEmail = (EditText) findViewById(R.id.etEmail); dBhelper = new DBHelper(this); } @Override public void onClick(View v) { ContentValues cv = new ContentValues(); String name = etName.getText().toString(); String email = etEmail.getText().toString(); SQLiteDatabase db = dBhelper.getWritableDatabase(); switch (v.getId()){ case R.id.btnAdd: Log.d(LOG_TAG, "---Insert in my table---"); cv.put("name", name); cv.put("email", email); long rowId = db.insert("mytable", null, cv); Log.d(LOG_TAG, "raw inserted, ID "+rowId); break; case R.id.btnRead: Log.d(LOG_TAG, "---Raws in my table ---"); Cursor c = db.query("mytable",null,null,null,null,null,null); if (c.moveToFirst()){ int idColIndex = c.getColumnIndex("id"); int nameColIndex = c.getColumnIndex("name"); int emailColIndex = c.getColumnIndex("email"); do { Log.d(LOG_TAG, "ID = "+c.getInt(idColIndex)+ ", name = "+c.getString(nameColIndex)+ ", email = "+c.getString(emailColIndex)); } while (c.moveToNext()); }else { Log.d(LOG_TAG, "0 raws"); c.close(); break; } case R.id.btnClear: Log.d(LOG_TAG, "---Clear my table---"); int clearCount = db.delete("mytable", null, null); Log.d(LOG_TAG, "deleted raws count ="+clearCount); break; } dBhelper.close(); } class DBHelper extends SQLiteOpenHelper{ public DBHelper(Context context) { super(context, "nyDb", null, 1); } @Override public void onCreate(SQLiteDatabase db) { Log.d(LOG_TAG, "---onCreateDatabase---"); db.execSQL("create table mytable (" + "id integer primary key autoincrement," + "name text," + "email text"+");"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } } } 
  • Duplicate this question . If you want to add something, edit the question with the "edit" button under the question, and not create a new one. - pavlofff
  • I wanted to raise the question, because I did not find a solution. Old deleted - Opimand
  • When editing the question also rises. However, if for the first time they did not give an answer, probably no one knows what the problem is. In general, the Meizu firmware is not known to be fully compatible with android and it is worth looking for a crutch for these phones in this direction, apparently it is not very interesting to anyone. - pavlofff

0