4.2.1 Android setup Existing Regular Project - reubenjohn/aceqlandroid GitHub Wiki
Here's how to integrate AceQLAndroid with your existing android project that is not version controlled by Git.
###Step 1
Visit the AceQLAndroid repository and either clone the repository with the git clone https://github.com/reubenjohn/aceqlandroid.git
command or hit the Download ZIP
button.
###Step 2
If you downloaded the zip, then extract the zip and rename the extracted folder to aceqlandroid
(case sensitive).
###Step 3 Open up your existing project from Android studio, and import the aceqlandroid module:
File->New->Import Module...
- In the
Source directory field
, you need to provide the path to the aceqlandroid folder you extracted. Once you've done that, theModule name
should show up as:aceqlandroid
by default.
###Step 4
Open your app's build.gradle file. It's important to note that it is not the one located directly inside your project, but is rather located inside your main module's folder (usually named app
). So once you've opened up the file (usually yourprojectfolder/app/build.gradle
), you'll find a dependencies
section that may contain statements such as compile fileTree(dir: 'libs', include: ['*.jar'])
. To this section you'll also need to add the statement compile project(':aceqlandroid')
. This will tell Android Studio that your primary module is dependant on the aceqlandroid module. This will allow you to access code and functionality of aceqlandroid from within your own code.
###Step 5
A Sync Now
button should have dropped down in a banner at the top in response to editing the gradle script. Simply click that button and wait a few minutes for the sync to complete.
###Step 6
Open your AndroidManifest.xml
file of your main module, and inside the application
tag, if you find the an entry like android:name
, then it means you've already got an Application class. If there's no such entry, then add the entry android:name=""
and try for suggestions with your cursor within the quotes. If no suggestions show, then it's quite certain that you don't have an Application class.
###Step 7
- If you don't have an Application class, then you can create one by creating a Java class in your application's package (called say
App
). - Make this class extend
Application
from theandroid.app.Application
package. - Open your
AndroidManifest.xml
file, inside theapplication tag
, specify the entryandroid:name=".App"
###Step 8
In your App
class, override the onCreate
function and add the statement: AceQLDBManager.initialize("aceql_url","your_username","your_password");
.
Where your aceql_url
is usually of the form: jdbc:aceql:http://your_aceql_server_ip_address:9090/ServerSqlManager
.
Once that's done without any errors, you should have successfully integrated aceqlandroid with your existing android project!