Skip to content

Commit a77e03e

Browse files
update android project
1 parent 286e5be commit a77e03e

17 files changed

+472
-51
lines changed

.gitignore

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ build/
3333
pubspec.lock
3434

3535
# Android related
36-
**/android/**/gradle-wrapper.jar
37-
**/android/.gradle
38-
**/android/captures/
39-
**/android/gradlew
40-
**/android/gradlew.bat
41-
**/android/local.properties
42-
**/android/**/GeneratedPluginRegistrant.java
36+
example/android_backup/**/gradle-wrapper.jar
37+
example/android_backup/.gradle
38+
example/android_backup/captures/
39+
example/android_backup/gradlew
40+
example/android_backup/gradlew.bat
41+
example/android_backup/local.properties
42+
example/android_backup/**/GeneratedPluginRegistrant.java
4343

4444
# iOS/XCode related
4545
**/ios/**/*.mode1v3

example/.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ app.*.symbols
4040
app.*.map.json
4141

4242
# Android Studio will place build artifacts here
43-
/android/app/debug
44-
/android/app/profile
45-
/android/app/release
43+
/android_backup/app/debug
44+
/android_backup/app/profile
45+
/android_backup/app/release

example/.metadata

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1"
7+
revision: "2663184aa79047d0a33a14a3b607954f8fdd8730"
88
channel: "stable"
99

1010
project_type: app
@@ -13,23 +13,26 @@ project_type: app
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
17-
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
16+
create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
17+
base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
1818
- platform: android
19-
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
20-
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
19+
create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
20+
base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
2121
- platform: ios
22-
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
23-
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
22+
create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
23+
base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
24+
- platform: linux
25+
create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
26+
base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
2427
- platform: macos
25-
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
26-
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
28+
create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
29+
base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
2730
- platform: web
28-
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
29-
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
31+
create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
32+
base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
3033
- platform: windows
31-
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
32-
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
34+
create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
35+
base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
3336

3437
# User provided section
3538

example/android/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gradle-wrapper.jar
77
GeneratedPluginRegistrant.java
88

99
# Remember to never publicly share your keystore.
10-
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
10+
# See https://flutter.dev/to/reference-keystore
1111
key.properties
1212
**/*.keystore
1313
**/*.jks

example/android/app/build.gradle

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,8 @@ plugins {
55
id "dev.flutter.flutter-gradle-plugin"
66
}
77

8-
def localProperties = new Properties()
9-
def localPropertiesFile = rootProject.file("local.properties")
10-
if (localPropertiesFile.exists()) {
11-
localPropertiesFile.withReader("UTF-8") { reader ->
12-
localProperties.load(reader)
13-
}
14-
}
15-
16-
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
17-
if (flutterVersionCode == null) {
18-
flutterVersionCode = "1"
19-
}
20-
21-
def flutterVersionName = localProperties.getProperty("flutter.versionName")
22-
if (flutterVersionName == null) {
23-
flutterVersionName = "1.0"
24-
}
25-
268
android {
27-
namespace = "dev.danvickmiller.formbuildervalidators.example"
9+
namespace = "com.example.example"
2810
compileSdk = flutter.compileSdkVersion
2911
ndkVersion = flutter.ndkVersion
3012

@@ -33,14 +15,19 @@ android {
3315
targetCompatibility = JavaVersion.VERSION_1_8
3416
}
3517

18+
kotlinOptions {
19+
jvmTarget = JavaVersion.VERSION_1_8
20+
}
21+
3622
defaultConfig {
37-
applicationId = "dev.danvickmiller.formbuildervalidators.example"
23+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
24+
applicationId = "com.example.example"
3825
// You can update the following values to match your application needs.
39-
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
26+
// For more information, see: https://flutter.dev/to/review-gradle-config.
4027
minSdk = flutter.minSdkVersion
4128
targetSdk = flutter.targetSdkVersion
42-
versionCode = flutterVersionCode.toInteger()
43-
versionName = flutterVersionName
29+
versionCode = flutter.versionCode
30+
versionName = flutter.versionName
4431
}
4532

4633
buildTypes {

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
1+
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
22
android.useAndroidX=true
33
android.enableJetifier=true

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip

example/android/settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "7.3.0" apply false
22-
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
21+
id "com.android.application" version "8.1.0" apply false
22+
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
2323
}
2424

2525
include ":app"

example/linux/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flutter/ephemeral

example/linux/CMakeLists.txt

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Project-level configuration.
2+
cmake_minimum_required(VERSION 3.10)
3+
project(runner LANGUAGES CXX)
4+
5+
# The name of the executable created for the application. Change this to change
6+
# the on-disk name of your application.
7+
set(BINARY_NAME "example")
8+
# The unique GTK application identifier for this application. See:
9+
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
10+
set(APPLICATION_ID "com.example.example")
11+
12+
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
13+
# versions of CMake.
14+
cmake_policy(SET CMP0063 NEW)
15+
16+
# Load bundled libraries from the lib/ directory relative to the binary.
17+
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
18+
19+
# Root filesystem for cross-building.
20+
if(FLUTTER_TARGET_PLATFORM_SYSROOT)
21+
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
22+
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
23+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
25+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
26+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
27+
endif()
28+
29+
# Define build configuration options.
30+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
31+
set(CMAKE_BUILD_TYPE "Debug" CACHE
32+
STRING "Flutter build mode" FORCE)
33+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
34+
"Debug" "Profile" "Release")
35+
endif()
36+
37+
# Compilation settings that should be applied to most targets.
38+
#
39+
# Be cautious about adding new options here, as plugins use this function by
40+
# default. In most cases, you should add new options to specific targets instead
41+
# of modifying this function.
42+
function(APPLY_STANDARD_SETTINGS TARGET)
43+
target_compile_features(${TARGET} PUBLIC cxx_std_14)
44+
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
45+
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
46+
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
47+
endfunction()
48+
49+
# Flutter library and tool build rules.
50+
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
51+
add_subdirectory(${FLUTTER_MANAGED_DIR})
52+
53+
# System-level dependencies.
54+
find_package(PkgConfig REQUIRED)
55+
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
56+
57+
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
58+
59+
# Define the application target. To change its name, change BINARY_NAME above,
60+
# not the value here, or `flutter run` will no longer work.
61+
#
62+
# Any new source files that you add to the application should be added here.
63+
add_executable(${BINARY_NAME}
64+
"main.cc"
65+
"my_application.cc"
66+
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
67+
)
68+
69+
# Apply the standard set of build settings. This can be removed for applications
70+
# that need different build settings.
71+
apply_standard_settings(${BINARY_NAME})
72+
73+
# Add dependency libraries. Add any application-specific dependencies here.
74+
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
75+
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
76+
77+
# Run the Flutter tool portions of the build. This must not be removed.
78+
add_dependencies(${BINARY_NAME} flutter_assemble)
79+
80+
# Only the install-generated bundle's copy of the executable will launch
81+
# correctly, since the resources must in the right relative locations. To avoid
82+
# people trying to run the unbundled copy, put it in a subdirectory instead of
83+
# the default top-level location.
84+
set_target_properties(${BINARY_NAME}
85+
PROPERTIES
86+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
87+
)
88+
89+
90+
# Generated plugin build rules, which manage building the plugins and adding
91+
# them to the application.
92+
include(flutter/generated_plugins.cmake)
93+
94+
95+
# === Installation ===
96+
# By default, "installing" just makes a relocatable bundle in the build
97+
# directory.
98+
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
99+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
100+
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
101+
endif()
102+
103+
# Start with a clean build bundle directory every time.
104+
install(CODE "
105+
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
106+
" COMPONENT Runtime)
107+
108+
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
109+
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
110+
111+
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
112+
COMPONENT Runtime)
113+
114+
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
115+
COMPONENT Runtime)
116+
117+
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
118+
COMPONENT Runtime)
119+
120+
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
121+
install(FILES "${bundled_library}"
122+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
123+
COMPONENT Runtime)
124+
endforeach(bundled_library)
125+
126+
# Copy the native assets provided by the build.dart from all packages.
127+
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
128+
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
129+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
130+
COMPONENT Runtime)
131+
132+
# Fully re-copy the assets directory on each build to avoid having stale files
133+
# from a previous install.
134+
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
135+
install(CODE "
136+
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
137+
" COMPONENT Runtime)
138+
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
139+
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
140+
141+
# Install the AOT library on non-Debug builds only.
142+
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
143+
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
144+
COMPONENT Runtime)
145+
endif()

0 commit comments

Comments
 (0)