joaoventura / pybridge

Reuse Python code in native Android applications
215 stars 56 forks source link

Need to hide my python file #34

Open vidhyagithub opened 4 years ago

vidhyagithub commented 4 years ago

Thanks for the Project.

Would like to know if there is a way to hide my python logic (bootstrap.py code) so that it does not get exposed. Have few python files which I am trying to run along with my Android native files (C/CPP) - Can you please throw some lights on this?

joaoventura commented 4 years ago

The only solution I can think of is to compile it to pyc/pyo.. Use the same python version on your computer and on pybridge, and you can use the files in the pycache directory..

qpqg commented 2 years ago

Terima kasih untuk Proyek.

Ingin tahu apakah ada cara untuk menyembunyikan logika python saya (kode bootstrap.py) sehingga tidak terekspos. Punya beberapa file python yang saya coba jalankan bersama dengan file asli Android saya (C/CPP) - Bisakah Anda menjelaskan ini?

How about your asset/python folder example?I'm having problems when I run the app.

Is this the correct placement? IMG_20220210_082017

The error I got

FATAL EXCEPTION: main
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               Process: com.jventura.pyapp, PID: 1422
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/LifecycleEventObserver;
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at java.lang.Class.newInstance(Native Method)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:41)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at android.app.Instrumentation.newActivity(Instrumentation.java:1251)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3220)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3457)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at android.os.Handler.dispatchMessage(Handler.java:107)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at android.os.Looper.loop(Looper.java:224)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at android.app.ActivityThread.main(ActivityThread.java:7562)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at java.lang.reflect.Method.invoke(Native Method)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.LifecycleEventObserver" on path: DexPathList[[zip file "/data/app/com.jventura.pyapp-AVkAvM7u4eUj0BblprogJA==/base.apk"],nativeLibraryDirectories=[/data/app/com.jventura.pyapp-AVkAvM7u4eUj0BblprogJA==/lib/arm, /data/app/com.jventura.pyapp-AVkAvM7u4eUj0BblprogJA==/base.apk!/lib/armeabi-v7a, /system/lib, /product/lib]]
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
02-10 08:44:42.031 1422 1422 E     AndroidRuntime                               ... 16 more
qpqg commented 2 years ago

I checked the installed apps but only got the .py file

IMG_20220210_083853