diff --git a/experimental/add_to_app/SimpleAndroidApp/.gitignore b/experimental/add_to_app/SimpleAndroidApp/.gitignore new file mode 100644 index 000000000..2b75303ac --- /dev/null +++ b/experimental/add_to_app/SimpleAndroidApp/.gitignore @@ -0,0 +1,13 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/experimental/add_to_app/SimpleAndroidApp/app/.gitignore b/experimental/add_to_app/SimpleAndroidApp/app/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/experimental/add_to_app/SimpleAndroidApp/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/experimental/add_to_app/SimpleAndroidApp/app/build.gradle b/experimental/add_to_app/SimpleAndroidApp/app/build.gradle new file mode 100644 index 000000000..adc607e64 --- /dev/null +++ b/experimental/add_to_app/SimpleAndroidApp/app/build.gradle @@ -0,0 +1,39 @@ +apply plugin: 'com.android.application' + +apply plugin: 'kotlin-android' + +apply plugin: 'kotlin-android-extensions' + +android { + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } + compileSdkVersion 28 + defaultConfig { + applicationId "com.example.simpleandroidapp" + minSdkVersion 19 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation 'android.arch.lifecycle:common-java8:1.1.1' + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'com.android.support.constraint:constraint-layout:1.1.3' + implementation project(':flutter') + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' +} diff --git a/experimental/add_to_app/SimpleAndroidApp/app/proguard-rules.pro b/experimental/add_to_app/SimpleAndroidApp/app/proguard-rules.pro new file mode 100644 index 000000000..f1b424510 --- /dev/null +++ b/experimental/add_to_app/SimpleAndroidApp/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/experimental/add_to_app/SimpleAndroidApp/app/src/androidTest/java/com/example/simpleandroidapp/ExampleInstrumentedTest.kt b/experimental/add_to_app/SimpleAndroidApp/app/src/androidTest/java/com/example/simpleandroidapp/ExampleInstrumentedTest.kt new file mode 100644 index 000000000..bd91b7615 --- /dev/null +++ b/experimental/add_to_app/SimpleAndroidApp/app/src/androidTest/java/com/example/simpleandroidapp/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.simpleandroidapp + +import android.support.test.InstrumentationRegistry +import android.support.test.runner.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getTargetContext() + assertEquals("com.example.simpleandroidapp", appContext.packageName) + } +} diff --git a/experimental/add_to_app/SimpleAndroidApp/app/src/main/AndroidManifest.xml b/experimental/add_to_app/SimpleAndroidApp/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000..fb8c7a579 --- /dev/null +++ b/experimental/add_to_app/SimpleAndroidApp/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/experimental/add_to_app/SimpleAndroidApp/app/src/main/java/com/example/simpleandroidapp/MainActivity.kt b/experimental/add_to_app/SimpleAndroidApp/app/src/main/java/com/example/simpleandroidapp/MainActivity.kt new file mode 100644 index 000000000..96767ec01 --- /dev/null +++ b/experimental/add_to_app/SimpleAndroidApp/app/src/main/java/com/example/simpleandroidapp/MainActivity.kt @@ -0,0 +1,18 @@ +package com.example.simpleandroidapp + +import android.support.v7.app.AppCompatActivity +import android.os.Bundle +import android.widget.Button +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + val button = findViewById