update android gradle configuration and declare activity in library

If you declare the activity in the library, the hosting application's
manifest will get merged with the library manifest and then the end user
doesn't have to edit their manifest before this plugin works.

also updated to latest gradle plugin and kotlin versions
This commit is contained in:
dustin 2018-08-09 14:21:26 -07:00
parent ee0579a584
commit dcfdc5a0c4
8 changed files with 24 additions and 17 deletions

View File

@ -10,8 +10,8 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-4' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51'
} }
} }
@ -28,7 +28,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
android { android {
compileSdkVersion 27 compileSdkVersion 28
buildToolsVersion '27.0.3' buildToolsVersion '27.0.3'
sourceSets { sourceSets {
@ -36,7 +36,7 @@ android {
} }
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 25 targetSdkVersion 28
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@ -47,7 +47,7 @@ android {
} }
dependencies { dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-4' implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.51'
implementation 'me.dm7.barcodescanner:zxing:1.9.8' implementation 'me.dm7.barcodescanner:zxing:1.9.8'
implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:design:27.1.1'
} }

View File

@ -1,3 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourcompany.barcodescan"> package="com.yourcompany.barcodescan">
<application>
<activity android:name="com.apptreesoftware.barcodescan.BarcodeScannerActivity" />
</application>
</manifest> </manifest>

View File

@ -16,8 +16,8 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
compileSdkVersion 25 compileSdkVersion 28
buildToolsVersion '25.0.3' buildToolsVersion "27.0.3"
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/kotlin' main.java.srcDirs += 'src/main/kotlin'
@ -31,7 +31,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.yourcompany.barcodescanexample" applicationId "com.yourcompany.barcodescanexample"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 25 targetSdkVersion 28
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@ -51,5 +51,5 @@ flutter {
} }
dependencies { dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.2-4' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
} }

View File

@ -35,6 +35,5 @@
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.apptreesoftware.barcodescan.BarcodeScannerActivity"/>
</application> </application>
</manifest> </manifest>

View File

@ -1,22 +1,22 @@
buildscript { buildscript {
ext.kotlin_version = '1.2.41'
repositories { repositories {
google()
jcenter() jcenter()
maven {
url "https://maven.google.com"
}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }
allprojects { allprojects {
repositories { repositories {
google()
jcenter() jcenter()
maven { maven {
url "https://maven.google.com" url "https://maven.google.com" // Google's Maven repository
} }
} }
} }
@ -24,6 +24,8 @@ allprojects {
rootProject.buildDir = '../build' rootProject.buildDir = '../build'
subprojects { subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}" project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

View File

@ -1 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"

View File

@ -1 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"