Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}

dependencies {
classpath "com.android.tools.build:gradle:0.7.+"
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}

Expand All @@ -13,6 +15,7 @@ allprojects {
group = GROUP

repositories {
mavenCentral()
google()
jcenter()
}
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=jgilfelt
POM_DEVELOPER_NAME=Jeff Gilfelt
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
#Mon Apr 16 13:02:10 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
78 changes: 43 additions & 35 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 5 additions & 11 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 15 additions & 7 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
apply plugin: 'android-library'
import com.android.builder.core.BuilderConstants

apply plugin: 'com.android.library'

android {
buildToolsVersion '19.0.0'
compileSdkVersion 19
buildToolsVersion '27.0.3'
compileSdkVersion 26

defaultConfig {
minSdkVersion 7
minSdkVersion 16
}
}

defaultPublishConfig "release"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals(com.android.builder.BuilderConstants.DEBUG)) {
if (name == BuilderConstants.DEBUG) {
return; // Skip debug builds.
}
def task = project.tasks.create "jar${name.capitalize()}", Jar
Expand All @@ -20,4 +27,5 @@ android.libraryVariants.all { variant ->
artifacts.add('archives', task);
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
dependencies {
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public synchronized SQLiteDatabase getWritableDatabase() {

// do force upgrade
if (version != 0 && version < mForcedUpgradeVersion) {
db.disableWriteAheadLogging();
db.close();
db = createOrOpenDatabase(true);
db.setVersion(mNewVersion);
version = db.getVersion();
Expand Down Expand Up @@ -262,6 +264,7 @@ public synchronized SQLiteDatabase getReadableDatabase() {
mIsInitializing = true;
String path = mContext.getDatabasePath(mName).getPath();
db = SQLiteDatabase.openDatabase(path, mFactory, SQLiteDatabase.OPEN_READONLY);
db.disableWriteAheadLogging();
if (db.getVersion() != mNewVersion) {
throw new SQLiteException("Can't upgrade read-only database from version " +
db.getVersion() + " to " + mNewVersion + ": " + path);
Expand All @@ -288,6 +291,7 @@ public synchronized void close() {
mDatabase.close();
mDatabase = null;
}
super.close();
}

@Override
Expand Down Expand Up @@ -391,6 +395,7 @@ private SQLiteDatabase createOrOpenDatabase(boolean force) throws SQLiteAssetExc
// database already exists
if (force) {
Log.w(TAG, "forcing database upgrade!");
db.close();
copyDatabaseFromAssets();
db = returnDatabase();
}
Expand All @@ -407,6 +412,7 @@ private SQLiteDatabase returnDatabase(){
try {
SQLiteDatabase db = SQLiteDatabase.openDatabase(mDatabasePath + "/" + mName, mFactory, SQLiteDatabase.OPEN_READWRITE);
Log.i(TAG, "successfully opened database " + mName);
db.disableWriteAheadLogging();
return db;
} catch (SQLiteException e) {
Log.w(TAG, "could not open database " + mName + " - " + e.getMessage());
Expand Down Expand Up @@ -513,4 +519,4 @@ public SQLiteAssetException(String error) {
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static List<String> splitSqlScript(String script, char delim) {
}

public static void writeExtractedFileToDisk(InputStream in, OutputStream outs) throws IOException {
byte[] buffer = new byte[1024];
byte[] buffer = new byte[4096];
int length;
while ((length = in.read(buffer))>0){
outs.write(buffer, 0, length);
Expand Down
13 changes: 6 additions & 7 deletions samples/database-v1/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
apply plugin: 'android'
apply plugin: 'com.android.application'

dependencies {
compile project(':library')
implementation project(':library')
}

android {
buildToolsVersion '19.0.0'
compileSdkVersion 19
buildToolsVersion '27.0.3'
compileSdkVersion 26

defaultConfig {
minSdkVersion 8
packageName 'com.example.sqliteassethelper'
targetSdkVersion 19
applicationId 'com.example.sqliteassethelper'
targetSdkVersion 26
versionCode 1
versionName '1.0'
}

}
22 changes: 7 additions & 15 deletions samples/database-v13-upgrade/build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android'
apply plugin: 'com.android.application'

repositories {
mavenCentral()
}

android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
compileSdkVersion 26
buildToolsVersion '27.0.3'

defaultConfig {
minSdkVersion 8
targetSdkVersion 19
targetSdkVersion 26
versionCode 3
versionName "3.0"
}
buildTypes {
release {
runProguard false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile project(':library')
}
implementation project(':library')
}
Loading