diff --git a/experimental/add_to_app/android_using_prebuilt_module/.gitignore b/experimental/add_to_app/android_using_prebuilt_module/.gitignore new file mode 100644 index 000000000..603b14077 --- /dev/null +++ b/experimental/add_to_app/android_using_prebuilt_module/.gitignore @@ -0,0 +1,14 @@ +*.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 +.cxx diff --git a/experimental/add_to_app/android_using_prebuilt_module/app/.gitignore b/experimental/add_to_app/android_using_prebuilt_module/app/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/experimental/add_to_app/android_using_prebuilt_module/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/experimental/add_to_app/android_using_prebuilt_module/app/build.gradle b/experimental/add_to_app/android_using_prebuilt_module/app/build.gradle new file mode 100644 index 000000000..45ab34657 --- /dev/null +++ b/experimental/add_to_app/android_using_prebuilt_module/app/build.gradle @@ -0,0 +1,58 @@ +apply plugin: 'com.android.application' + +apply plugin: 'kotlin-android' + +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion 28 + buildToolsVersion "29.0.2" + defaultConfig { + applicationId "dev.flutter.example.androidusingprebuiltmodule" + minSdkVersion 19 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + } + } + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } +} + +repositories { + maven { + // This maven repo is created when you run `flutter build aar`. It contains compiled code + // and resources for flutter_module itself. + url '../../flutter_module/build/host/outputs/repo' + } + maven { + // This maven repo contains artifacts for Flutter's Android embedding. + url 'http://download.flutter.io' + } +} + +dependencies { + releaseImplementation ('dev.flutter.example.flutter_module:flutter_release:1.0@aar') { + transitive = true + } + + debugImplementation ('dev.flutter.example.flutter_module:flutter_debug:1.0@aar') { + transitive = true + } + + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.core:core-ktx:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' +} diff --git a/experimental/add_to_app/android_using_prebuilt_module/app/src/androidTest/java/dev/flutter/example/androidusingprebuiltmodule/ExampleInstrumentedTest.kt b/experimental/add_to_app/android_using_prebuilt_module/app/src/androidTest/java/dev/flutter/example/androidusingprebuiltmodule/ExampleInstrumentedTest.kt new file mode 100644 index 000000000..fdef677bf --- /dev/null +++ b/experimental/add_to_app/android_using_prebuilt_module/app/src/androidTest/java/dev/flutter/example/androidusingprebuiltmodule/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package dev.flutter.example.androidusingprebuiltmodule + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.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.getInstrumentation().targetContext + assertEquals("dev.flutter.example.androidusingprebuiltmodule", appContext.packageName) + } +} diff --git a/experimental/add_to_app/android_using_prebuilt_module/app/src/main/AndroidManifest.xml b/experimental/add_to_app/android_using_prebuilt_module/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000..a91118488 --- /dev/null +++ b/experimental/add_to_app/android_using_prebuilt_module/app/src/main/AndroidManifest.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + diff --git a/experimental/add_to_app/android_using_prebuilt_module/app/src/main/java/dev/flutter/example/androidusingprebuiltmodule/MainActivity.kt b/experimental/add_to_app/android_using_prebuilt_module/app/src/main/java/dev/flutter/example/androidusingprebuiltmodule/MainActivity.kt new file mode 100644 index 000000000..f7f6f8997 --- /dev/null +++ b/experimental/add_to_app/android_using_prebuilt_module/app/src/main/java/dev/flutter/example/androidusingprebuiltmodule/MainActivity.kt @@ -0,0 +1,37 @@ +// Copyright 2019 The Flutter team. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package dev.flutter.example.androidusingprebuiltmodule + +import android.os.Bundle +import android.widget.Button +import android.widget.TextView +import androidx.appcompat.app.AppCompatActivity +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : AppCompatActivity() { + private var counterLabel: TextView? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + counterLabel = findViewById(R.id.counter_label) + + val button = findViewById