Closed bangonkali closed 5 years ago
Are you using the flutter_liquidcore
module? @j0j00 developed that extension for flutter and may be able to help. I haven't worked with flutter, yet, so it would be a learning curve for me.
hi @ericwlange i haven't tried using fluter_liquidcore. my use case is rather different because the v8 engine has to be on the android layer - communicating only with the flutter layer over mqtt because it's currently written as an android service running on a different process. the flutter layer is purely for ui presentation but the backend should survive closing of the app, and hence written as a service on a separate process.
When you look at the contents of your APK, what does it look like? In Android Studio, Build -> Analyze APK
and select your built APK. E.g., for one of mine (with the expanded lib/x86_64
directory):
Is libflutter.so
present?
Unfortunately this is the only thing i see.
this one runs but fails on startup with missing flutter.so
as error on issue.
but if i comment out
// app/build.gradle
...
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
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'
// implementation 'com.github.LiquidPlayer:LiquidCore:0.6.0'
}
...
then i see a build named outputs/apk/debug/app-debug.apk
and this is the result
this on renders out flutter well.
as this might help:
build with the extension it seems this is the apk that is produced:
outputs/apk/debug/app-arm64-v8a-debug.apk
build without the extension it seems there is a different apk that is produced:
outputs/apk/debug/app-debug.apk
the phone i use for testing is Samsung Galaxy S10
and the contents of app/build.gradle
is
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "ph.com.regalado.filo.filo"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
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'
// implementation 'com.github.LiquidPlayer:LiquidCore:0.6.0'
}
build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "ph.com.regalado.filo.filo"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
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'
// implementation 'com.github.LiquidPlayer:LiquidCore:0.6.0'
}
okay, so i redid the whole thing this time doing the following before building.
flutter clean
build
-> clean project
and this is what i got.
if feels like i'm very close 🤣 it just seems, arm64-v8a
has no flutter.so
but the rest has it.
That's so strange! I'm so sorry that I can't really help much, since I haven't even tried flutter yet. But it does seem like you're on the right track. I am happy to see that libliquidcore.so
and libnode.so
are there, though! Those are all you need for LiquidCore to work.
hi @ericwlange your guidance has been instrumental. it seems the solution for flutter
+ ndk related modules is this.
ndk {
if (project.hasProperty('target-platform') &&
project.property('target-platform') == 'android-arm64') {
abiFilters 'arm64-v8a'
} else {
abiFilters 'armeabi-v7a'
}
}
VS Cod extension seems to know exactly what device to build against. Hence it's building x64 version.
regarding my initial post, it runs on VSCODE, because flutter build
considered the output. lower right corner of the above screenshot. flutter.so is build on 64bit but 64 bit only. as discussed here.
apk analysed here
When building using default build config from Android Studio, it builds flutter.so for all except 64bit version as shown here.
the fix was this.
https://github.com/flutter/flutter/issues/18494#issuecomment-475732536
i am closing this as my issue is resolved and it was never a liquidcore issue in the first place. the flutter guys are probably going to do something about it someday.
thank you very much for your superb support! highly appreciated!!! 👍👍👍
also i now know how to use analyze apk 🤣🤣🤣
Greate library so far! But im getting a weird behaviour for which I made a simple repo to demonstrate this fact.
Behavior: Builds and runs using
flutter run
but fails usingAndroid Studio
debug. See an error on the bottom. Gist of error iscouldn't find "libflutter.so"
.I use flutter primarily on my UI front end and Kotlin as backend all on Android.
Flutter project was created using the following command:
Output should be roughtly similar to this commit.
You can run the generated sample code from both VS Code Flutter extension and Android Studio by opening the
android
folder as an android project.After adding the deps as commit here, the project no longer works using Android Studio as the Build then Run Platform.
Any ideas?