UCI-Networking-Group / AntMonitor

The AntMonitor app and library for VPN-based traffic inspection on Android
GNU General Public License v2.0
22 stars 11 forks source link

FATAL ERROR while updating the app to a modified version #4

Closed j-piatek closed 4 years ago

j-piatek commented 4 years ago

Hello! I'm trying to enable CONTRIBUTION SECTIONS of AntMonitor, but when I build and run the code, I get an error. Tis is a strange error because if I run the app in one device it works, but if I run it in another device, it doesn't work and I get this error. I've seen that maybe change the DATABASE VERSION could be a solution, I tried it and the error doesn't appear but the app is still crashing.
Thanks!

E/AndroidRuntime: FATAL EXCEPTION: main Process: edu.uci.calit2.anteatermo.dev, PID: 10313 java.lang.RuntimeException: Unable to start activity ComponentInfo{edu.uci.calit2.anteatermo.dev/edu.uci.calit2.anteater.client.android.activity.GettingStartedActivity}: android.view.InflateException: Binary XML file line #32: Binary XML file line #88: Binary XML file line #88: Error inflating class fragment at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2924) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985) at android.app.ActivityThread.-wrap14(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6692) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) Caused by: android.view.InflateException: Binary XML file line #32: Binary XML file line #88: Binary XML file line #88: Error inflating class fragment Caused by: android.view.InflateException: Binary XML file line #88: Binary XML file line #88: Error inflating class fragment Caused by: android.view.InflateException: Binary XML file line #88: Error inflating class fragment Caused by: android.database.sqlite.SQLiteException: no such column: action (code 1): , while compiling: SELECT _id, appname, label, pii, search_enabled, action, is_custom FROM TABLE_FILTERS WHERE appname is null AND label = ? ################################################################# Error Code : 1 (SQLITE_ERROR) Caused By : SQL(query) error or missing database. (no such column: action (code 1): , while compiling: SELECT _id, appname, label, pii, search_enabled, action, is_custom FROM TABLE_FILTERS WHERE appname is null AND label = ?) ################################################################# at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1008) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:573) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:59) at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37) at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44) at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1628) at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1475) at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1346) at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1514) at edu.uci.calit2.anteater.client.android.database.PrivacyDB.getPrivacyFilterByLabel(PrivacyDB.java:637) at edu.uci.calit2.anteater.client.android.database.PrivacyDB.getGlobalPrivacyFilterByLabel(PrivacyDB.java:686) at edu.uci.calit2.anteater.client.android.database.PrivacyDB.hasDefaultFilters(PrivacyDB.java:208) at edu.uci.calit2.anteater.client.android.database.PrivacyDB.getInstance(PrivacyDB.java:193) at edu.uci.calit2.anteater.client.android.activity.uielements.PrivacyFilterListAdapter.(PrivacyFilterListAdapter.java:66) at edu.uci.calit2.anteater.client.android.fragment.PrivacyFiltersFragment.onCreateView(PrivacyFiltersFragment.java:108) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2354) at android.support.v4.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManager.java:1645) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1390) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1640) at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1896) at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3673) at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:190) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734) at android.view.LayoutInflater.rInflate(LayoutInflater.java:865) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828) at android.view.LayoutInflater.rInflate(LayoutInflater.java:873) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828) at android.view.LayoutInflater.rInflate(LayoutInflater.java:873) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828) at android.view.LayoutInflater.rInflate(LayoutInflater.java:873) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828) at android.view.LayoutInflater.inflate(LayoutInflater.java:525) at android.view.LayoutInflater.inflate(LayoutInflater.java:427) at edu.uci.calit2.anteater.client.android.fragment.GSPrivacyFragment.onCreateView(GSPrivacyFragment.java:72) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2354) at android.support.v4.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManager.java:1645) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1390) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1640) at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1896) at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3673) at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111) at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:338) at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39) at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:784) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734) at android.view.LayoutInflater.rInflate(LayoutInflater.java:865) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828) at android.view.LayoutInflater.inflate(LayoutInflater.java:525) at android.view.LayoutInflater.inflate(LayoutInflater.java:427) at android.view.LayoutInflater.inflate(LayoutInflater.java:378) at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) at edu.uci.calit2.anteater.client.android.activity.GettingStartedActivity.onCreate(GettingStartedActivity.java:60) at android.app.Activity.performCreate(Activity.java:6912) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2877) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985) at android.app.ActivityThread.-wrap14(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6692) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

nshuba commented 4 years ago

Hi there! Thanks for reporting. I'll need a bit more information to investigate as I am having trouble reproducing the issue.

What Android version are you using? Does the crash occur during a clean install of the app with the contribution sections enabled (i.e. uninstall AntMonitor and the install it with the contribution sections enabled)?

j-piatek commented 4 years ago

I´ve been trying to enable the contribution sections in 2 different devices. The first one has Android 9.0 and the other one has Android 7.0. The crash occurred in the one with Android 9.0, but the same code worked perfectly in the device with Android 7.0.

I was installing and reinstalling the app via Android Studio, in other words, I was running the app in my devices connected via USB to my PC, so maybe there was the problem. Maybe some file was corrupted and that was the problem...

As I saw that the error was produced by the sentence that creates the ACTION column of the TABLE_HISTORY, I just modified the sentence deleting a space that Android Studio was showing me as an error, and when I build and ran the app, it worked also in the other device with Android 9.0.

I don´t know if it´s exactly a bug or it´s just something that I did incorrectly, because really the problem doesn´t have anything in common with enabling the contribution sections...

nshuba commented 4 years ago

Thanks for the details! I was still not able to reproduce, but your hint about AndroidStudio complaining led me to something. Turns out we were using an SQL keyword as one of our column names. Perhaps this keyword was not introduced to Android's SQLite until later versions, because I am not sure how it has worked before.

Hoping this fixes it, closing for now. Thanks!