srplab / starcore_for_flutter

middleware for flutter calling other script languages
140 stars 29 forks source link

Sample application does not work!! #13

Open lucas-daniel-sm opened 4 years ago

lucas-daniel-sm commented 4 years ago

I create an Androis app, like the instructions in the Documentation, but i have this error:

`I/skeletonproc_module,32041( 9227): create service group[0], community 32bit version[3.5.0.260] @www.srplab.com I/skeletonproc_module,32044( 9227): "SetRegisterCode" function can be used to change it to professional version dynamically I/skeletonproc_module,32089( 9227): lua engine[Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio] I/skeletonproc_module,1592( 9227): create service success[test] I/flutter ( 9227): docPath = /data/data/com.example.flutterpythonapp/files I/flutter ( 9227): resPath = /data/data/com.example.flutterpythonapp/files I/flutter ( 9227): -1 1 load library [/data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/lib/x86/libstar_python36.so] success.... 6 I/skeletonproc_module,48689( 9227): load library [/data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/lib/x86/libstar_python36.so] success.... D/starcore( 9227): Begin call _PyCodecRegistry_Init D/starcore( 9227): import encodings failed.... D/starcore( 9227): ZipImportError("can't decompress data; zlib not available",) D/starcore( 9227): /data/data/com.example.flutterpythonapp/files:/data/data/com.example.flutterpythonapp/files/python3.6.zip:/data/data/com.example.flutterpythonapp/files/libs:/data/data/com.googlecode.pythonforandroid/files:/sdcard/com.googlecode.pythonforandroid/extras/python:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6:/data/data/com.googlecode.pythonforandroid/files/python/lib/python26.zip D/starcore( 9227): Py_Initialize: unable to load the file system codec F/libc ( 9227): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 9313 (Thread-3), pid 9227 (lutterpythonapp)


Build fingerprint: 'google/sdk_gphone_x86/generic_x86:10/QSR1.190920.001/5891938:user/release-keys' Revision: '0' ABI: 'x86' Timestamp: 2020-04-02 13:25:16-0400 pid: 9227, tid: 9313, name: Thread-3 >>> com.example.flutterpythonapp <<< uid: 10135 signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr -------- eax 00000000 ebx 0000240b ecx 00002461 edx 00000006 edi f680433e esi bf879e60 ebp f7c7ead0 esp bf879e08 eip f7c7ead9 backtrace:

00 pc 00000ad9 [vdso] (__kernel_vsyscall+9)

  #01 pc 00092328  /apex/com.android.runtime/lib/bionic/libc.so (syscall+40) (BuildId: 76290498408016ad14f4b98c3ab6c65c)
  #02 pc 000ad651  /apex/com.android.runtime/lib/bionic/libc.so (abort+193) (BuildId: 76290498408016ad14f4b98c3ab6c65c)
  #03 pc 001645ce  /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/lib/x86/libpython3.6m.so (Py_FatalError+46)
  #04 pc 001658b7  /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/lib/x86/libpython3.6m.so (_Py_InitializeEx_Private+1575)
  #05 pc 00165923  /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/lib/x86/libpython3.6m.so (Py_InitializeEx+35)
  #06 pc 000668bb  /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/lib/x86/libstar_python36.so (libstar_python36_ScriptInit+1435)
  #07 pc 0039a0da  /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/lib/x86/libstarcore.so (SkeletonProc_ActiveScriptInterface(char*, char*, void*)+3114)
  #08 pc 0039a91d  /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/lib/x86/libstarcore.so (SkeletonProc_GetScriptInterface(char*)+45)
  #09 pc 00244c99  /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/lib/x86/libstarcore.so (ClassOfVSBasicSRPInterface::InitRaw(char const*, ClassOfSRPInterface*)+201)
  #10 pc 00046894  /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/lib/x86/libstar_java.so (Java_com_srplab_www_starcore_StarCoreFactory_SrvGroup_1InitRaw+132)
  #11 pc 00144f67  /apex/com.android.runtime/lib/libart.so (art_quick_generic_jni_trampoline+71) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #12 pc 0013e7d2  /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub+338) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #13 pc 00149a69  /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+281) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #14 pc 00332502  /apex/com.android.runtime/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+386) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #15 pc 0032c19c  /apex/com.android.runtime/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+988) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #16 pc 0068186d  /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+989) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #17 pc 00138821  /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #18 pc 000f3204  [anon:dalvik-classes.dex extracted in memory from /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/base.apk] (com.srplab.www.starcore.StarSrvGroupClass._InitRaw+4)
  #19 pc 00681adc  /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #20 pc 00138821  /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #21 pc 000e7646  [anon:dalvik-classes.dex extracted in memory from /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/base.apk] (com.srplab.starflut.StarflutPlugin.onMethodCall_Do+15558)
  #22 pc 00681adc  /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #23 pc 00138821  /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #24 pc 000e2e46  [anon:dalvik-classes.dex extracted in memory from /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/base.apk] (com.srplab.starflut.StarflutPlugin$2$1.handleMessage+102)
  #25 pc 00681adc  /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #26 pc 00138821  /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #27 pc 002f57a2  /system/framework/framework.jar (android.os.Handler.dispatchMessage+38)
  #28 pc 00681adc  /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #29 pc 00138821  /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #30 pc 00319eda  /system/framework/framework.jar (android.os.Looper.loop+466)
  #31 pc 00684f6c  /apex/com.android.runtime/lib/libart.so (MterpInvokeStatic+1260) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #32 pc 001389a1  /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_static+33) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #33 pc 000e30c6  [anon:dalvik-classes.dex extracted in memory from /data/app/com.example.flutterpythonapp-QLw8yXk21OuBnow5PksstQ==/base.apk] (com.srplab.starflut.StarflutPlugin$2.run+102)
  #34 pc 006837bc  /apex/com.android.runtime/lib/libart.so (MterpInvokeInterface+1980) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #35 pc 00138a21  /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_interface+33) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #36 pc 000ea918  /apex/com.android.runtime/javalib/core-oj.jar (java.lang.Thread.run+8)
  #37 pc 002f8e0a  /apex/com.android.runtime/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.12194892193087984976+298) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #38 pc 002ffcc5  /apex/com.android.runtime/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+181) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #39 pc 0066fbd9  /apex/com.android.runtime/lib/libart.so (artQuickToInterpreterBridge+1209) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #40 pc 0014503d  /apex/com.android.runtime/lib/libart.so (art_quick_to_interpreter_bridge+77) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #41 pc 0013e7d2  /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub+338) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #42 pc 00149a69  /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+281) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #43 pc 0055a513  /apex/com.android.runtime/lib/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+99) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #44 pc 0055b91a  /apex/com.android.runtime/lib/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+474) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #45 pc 005aaa51  /apex/com.android.runtime/lib/libart.so (art::Thread::CreateCallback(void*)+1585) (BuildId: 895645e5113da057f27d9b2ec11eb3bf)
  #46 pc 0011a8e5  /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+53) (BuildId: 76290498408016ad14f4b98c3ab6c65c)
  #47 pc 000af6a7  /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+71) (BuildId: 76290498408016ad14f4b98c3ab6c65c)

Lost connection to device.`

I think the problem is this: D/starcore( 9227): import encodings failed.... D/starcore( 9227): ZipImportError("can't decompress data; zlib not available",)

Thank you very much in advance!

srplab commented 4 years ago

The share library "zlib.cpython-36m.so" and "zlib.cpython-36m.so" in folder "example/android/app/src/main/assets" is for armeabi. They should be replaced with x86 version.

Davoodeh commented 4 years ago

Thanks for the guidance! That's the reason probably...

But any link to the various versions of the files?

Edit: found these files useful: https://github.com/srplab/starcore_for_android/blob/master/starcore_for_android.3.6.0.zip https://github.com/srplab/starcore_for_android

lucas-daniel-sm commented 4 years ago

I copied the assets from the example available on srplab.info (http://www.srplab.info/datas/flutter_and_python_sample.zip) to my project, when I run the "flutter run" it works normally, however when running "flutter build apk "I have the following error:

You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK
size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Removed unused resources: Binary resource data reduced from 44KB to 35KB: Removed 20%

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':starflut:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     C:\Users\lucas\.gradle\caches\transforms-2\files-2.1\0a271e99b6771ad4a84318244d532fb7\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\Users\lucas\.gradle\caches\transforms-2\files-2.1\0a271e99b6771ad4a84318244d532fb7\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 30s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                      91,5s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve
the incompatibility.
Building plugin starflut...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done                  105,9s
Downloading https://services.gradle.org/distributions/gradle-4.4-all.zip
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Unzipping C:\Users\lucas\.gradle\wrapper\dists\gradle-4.4-all\9br9xq1tocpiv8o6njlyu5op1\gradle-4.4-all.zip to C:\Users\lucas\.gradle\wrapper\dists\gradle-4.4-all\9br9xq1tocpiv8o6njlyu5op1
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'starflut'.
> The SDK directory 'C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\starflut-0.6.0\android\home\lihm\Android\Sdk' does not exist.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 45s

The plugin starflut could not be built due to the issue above.

After this error, I tried to use the library downloaded from github, and got the following error:

You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Removed unused resources: Binary resource data reduced from 44KB to 35KB: Removed 20%

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':starflut:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     C:\Users\lucas\.gradle\caches\transforms-2\files-2.1\0a271e99b6771ad4a84318244d532fb7\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\Users\lucas\.gradle\caches\transforms-2\files-2.1\0a271e99b6771ad4a84318244d532fb7\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 10s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                      71,6s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin starflut...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done                    1,3s
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'starflut'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

The plugin starflut could not be built due to the issue above.

I copied the "local.properties" file from the downloaded library from the flutter to the library I downloaded from github, and edited it as follows:

sdk.dir=C:/Users/lucas/AppData/Local/Android/Sdk
flutter.sdk=C:/src/flutter
flutter.versionName=0.0.1

I ran the "flutter build apk" again and I got the message below:

You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':starflut:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > 1 exception was raised by workers:
     com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
     C:\Users\lucas\.gradle\caches\transforms-2\files-2.1\52aeda8e04d8b8e585687eef29e0a45f\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\Users\lucas\.gradle\caches\transforms-2\files-2.1\52aeda8e04d8b8e585687eef29e0a45f\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 58s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                     179,4s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin starflut...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done                   43,5s
√ Built build\app\outputs\repo.
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                      28,7s
√ Built build\app\outputs\apk\release\app-release.apk (48.8MB).

However when installing the app on my smartphone (arm64) I get the message "flutterpythonapp apresenta falhas continuamente"

USAMAWIZARD commented 4 years ago

i build the app on the arm64 based processor and every thing worked fine

kevin7498 commented 2 years ago

The share library "zlib.cpython-36m.so" and "zlib.cpython-36m.so" in folder "example/android/app/src/main/assets" is for armeabi. They should be replaced with x86 version.

@srplab Where can I get x86 version??

abclangs commented 1 year ago

Hi. Did u solve this? How?