Android Studio project wrapper around the Elixir TodoApp Desktop app to run on Android including the Erlang runtime

Overview

TodoApp Android: An Android Sample App

This Android Studio project wraps the Desktop Sample App to run on an Android phone.

How to build & run

  1. Install Android Studio + NDK.

  2. Go to "Files -> New -> Project from Version Control" and enter this URL: https://github.com/elixir-desktop/android-example-app/

  3. Connect your Phone to Android Studio

  4. Start the App

Known todos

Initial Startup could be faster

Running the app for the first time will extract the full Elixir & App runtime at start. On my Phone this takes around 10 seconds. After that a cold app startup takes ~3-4 seconds.

Menus and other integration not yet available

This sample only launch the elixir app and shows it in an Android WebView. There is no integration yet with the Android Clipboard, sharing or other OS capabilities. They can though easily be added to the Bridge.kt file when needed.

Other notes

  • The current sample is using Android API 23 and above

  • The Erlang runtime is for ease of use embedded in this example git repository. The native runtimes for Android ARM, ARM64 and X86_64 and the exqlite nif are are generated using the Desktop Runtime repository.

  • Android specific settings, icons and metadata are all contained in this Android Studio wrapper project.

  • Bridge.kt and the native library are doing most of the wrapping of the Elixir runtime.

Screenshots

Icons App

Architecture

App

The Android App is initializing the Erlang VM and starting it up with a new environment variable BRIDGE_PORT. This environment variable is used by the Bridge project to connect to a local TCP server inside the android app. Through this new TCP communication channel all calls that usually would go to wxWidgets are now redirected. The Android side of things implements handling in Bridge.kt.

Comments
  • Unable to build required Erlang version with wxwidgets 3.2.0 on macOS Big Sur

    Unable to build required Erlang version with wxwidgets 3.2.0 on macOS Big Sur

    I'm on Big Sur and I have wxwidgets 3.2.0 and the latest kerl from Homebrew. When I try to build the required Erlang version, I run into this issue:

    ➜  ~ kerl build git https://github.com/diodechain/otp.git diode/beta 24.beta
    Checking out Erlang/OTP git repository from https://github.com/diodechain/otp.git...
    Building Erlang/OTP 24.beta from git, please wait...
    DOCUMENTATION INFORMATION (See: /Users/nicd/.kerl/builds/24.beta/otp_build_git.log)
     * documentation  :
     *                  fop is missing.
     *                  Using fakefop to generate placeholder PDF files.
    
    Build failed.
      const wxBitmap * Result = &This->GetBitmap();
                                ^~~~~~~~~~~~~~~~~~
    2 warnings and 1 error generated.
    gmake[3]: *** [Makefile:163: x86_64-apple-darwin20.6.0/wxe_wrapper_5.o] Error 1
    gmake[3]: Leaving directory '/Users/nicd/.kerl/builds/24.beta/otp_src_git/lib/wx/c_src'
    gmake[2]: *** [/Users/nicd/.kerl/builds/24.beta/otp_src_git/make/otp_subdir.mk:29: opt] Error 2
    gmake[2]: Leaving directory '/Users/nicd/.kerl/builds/24.beta/otp_src_git/lib/wx'
    gmake[1]: *** [/Users/nicd/.kerl/builds/24.beta/otp_src_git/make/otp_subdir.mk:29: opt] Error 2
    gmake[1]: Leaving directory '/Users/nicd/.kerl/builds/24.beta/otp_src_git/lib'
    gmake: *** [Makefile:498: libs] Error 2
    
    Please see /Users/nicd/.kerl/builds/24.beta/otp_build_git.log for full details.
    ➜  ~ brew info wxwidgets
    ==> wxwidgets: stable 3.2.0 (bottled), HEAD
    

    Looks like I'm running into this issue that's present on the iOS demo app too: https://github.com/elixir-desktop/ios-example-app/issues/3 that depends on https://github.com/erlang/otp/issues/5893.

    What would actually be required to be able to use OTP 24 or 25 from asdf with this project? Would it be a lot of work? I don't have a lot of knowledge on this, or time, but I could take a look at least.

    opened by Nicd 5
  • Update to OTP 24

    Update to OTP 24

    You mentioned in the README that the required changes have been added to master. I can't get an Android build working on Windows, would changing the otp source to otp24 be possible?

    opened by NduatiK 4
  • fix file path on run_mix

    fix file path on run_mix

    Hi! I try it. It is a magic. This is amazing project!

    I think that run_mix has a wrong path. Would you please review this pull request?

    I paste my smartphone screenshot.

    Screenshot_20211202_002205_io elixirdesktop example

    Thanks!

    opened by TORIFUKUKaiou 1
  • No driver found for wx

    No driver found for wx

    My app immediately crashes on startup with

    20:39:12.827 [error] ERROR: Could not find 'wxe_driver.so' in: /data/user/0/io.elixirdesktop.example/files/app/lib/wx-2.2/priv
    20:39:12.834 [notice] Application desktop exited: Desktop.start(:normal, []) returned an error: shutdown: failed to start child: Desktop.Env
            ** (EXIT) an exception was raised:
                ** (ErlangError) Erlang error: {:load_driver, 'No driver found'}
                    (wx 2.2) wxe_server.erl:65: :wxe_server.start/1
                    (wx 2.2) wx.erl:115: :wx.new/1
                    (desktop 1.4.1) lib/desktop/env.ex:28: Desktop.Env.init/1
                    (stdlib 4.0.1) gen_server.erl:848: :gen_server.init_it/2
                    (stdlib 4.0.1) gen_server.erl:811: :gen_server.init_it/6
                    (stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
    

    Everything builds correctly though.

    opened by Nicd 6
  • Environment variables not set for release

    Environment variables not set for release

    When I start my app, it crashes immediately with

    Starting beam...
    "/data/app/~~FKhNe6zQepp0iAw8dkkm4w==/io.elixirdesktop.example-OyaoOu7v7CwAl0mYQ0MkFQ==/lib/arm64/liberlang.so": ignoring DT_PREINIT_ARRAY in shared library!
    {"init terminating in do_boot",{#{'__exception__'=>true,'__struct__'=>'Elixir.ArgumentError',message=><<"could not fetch environment variable \"RELEASE_SYS_CONFIG\" because it is not set">>},[{'Elixir.System','fetch_env!',1,[{file,"lib/system.ex"},{line,698}]},{'Elixir.Config.Provider','resolve_config_path!',1,[{file,"lib/config/provider.ex"},{line,185}]},{'Elixir.Config.Provider',boot,1,[{file, "lib/config/provider.ex"},{line,222}]},{init,eval_script,2,[]},{init,do_boot,3,[]}]}}
    

    This is because in https://github.com/elixir-desktop/android-example-app/blob/d332169bcc968855848313f4bfda07d5e4d15027/app/src/main/cpp/native-lib.cpp#L99 the release is started in an unorthodox way, without running the release script. This means necessary env vars are not set.

    I got it fixed with this kludge in that same file:

        setenv("RELEASE_SYS_CONFIG", config_path.c_str(), 1);
        setenv("RELEASE_ROOT", root_dir.c_str(), 1);
    

    But I'm guessing for full compatibility either the startup should be changed to run the normal startup script (i.e. rel/<app>/bin/<app> start) or every env var from it should be emulated in a similar way as it does. I'm assuming the reason for starting the current way is to deal with Android specific stuff? I couldn't get it to start by calling the release script directly, but I'm really out of my depth in Android stuff.

    opened by Nicd 1
Owner
elixir-desktop
libraries and tools to create desktop apps with elixir and liveview (Windows, Linux, macOS, Android)
elixir-desktop
KotlinSample - Template project for building a GTK3 Kotlin/Native app against the elementary Flatpak runtime

GTK3 Kotlin/Native Sample This is a working example of how to write and build a

David Hewitt 10 Dec 5, 2022
FireApp is an open-source project that is built around Firebase Products, especially for learning purposes

FireApp is an open-source project that is built around Firebase Products, especially for learning purposes. This application is written entirely in Kotlin using Android Architecture Components and MVVM architecture pattern. You'll see in the code of this repo, how Firebase Products are working together.

Alex 45 Dec 18, 2022
A Full-Stack mobile app, including Android & Server, Simple-Poem 简诗. You can write poem in graceful & traditional Chinese style.

JianShi 简诗 A Full-Stack mobile app, including Android side & Server side, Simple-Poem 简诗. You can write poem in graceful & traditional Chinese style.

wingjay 1.9k Jan 6, 2023
Sample app demonstrating interop between Jetpack Compose and the Android UI toolkit, including SurfaceView

Wake Me Up Wake Me Up is a sample app showcased in the Google I/O 2021 Developer Keynote that demonstrates interoperability between Jetpack Compose an

Romain Guy 174 Dec 5, 2022
SimpleToDo is an android app that allows building a todo list and basic todo items management functionality including adding new items, editing and deleting an existing item.

SimpleToDo is an android app that allows building a todo list and basic todo items management functionality including adding new items, editing and deleting an existing item.

null 0 Jan 3, 2022
Todo List Application is an android app that allows building a todo list and basic todo items management functionality including adding new items, editing and deleting an existing item

Todo List Application is an android app that allows building a todo list and basic todo items management functionality including adding new items, editing and deleting an existing item

null 0 Jan 22, 2022
LeeCo is an awesome app for (including unlock) problems, solutions, discuss(from leetcode) and comments.

LeeCo LeeCo is an awesome app for algorithem problems(including unlock), solutions, discuss(from leetcode) and comments. #中文文档 README-ZH.md #Download

Nightonke 487 Nov 25, 2022
FairEmail is easy to set up and works with virtually all email providers, including Gmail, Outlook and Yahoo!

Downloads • Privacy • Support • License FairEmail Fully featured, open source, privacy oriented email app for Android FairEmail is easy to set up and

Marcel Bokhorst 1.5k Jan 2, 2023
React-native-user-interface - Change React Native userinterface at runtime

react-native-user-interface change RN userinterface at runtime. Installation npm

Ahmed Eid 0 Jan 11, 2022
A weather app demo made to play around with Kotlin Multiplatform.

A weather app demo made to play around with Kotlin Multiplatform. Running on Desktop, Ios and Android with all of the business logic being shared across all three platforms!

null 23 Jan 18, 2022
Android App Development using Android Studio Project for The Swastika. It is edit profile view.

Edit_Profile_View Android App Development using Android Studio Project for The Swastika. It is edit profile view. To start with this project first is

Shradha Suryawanshi 1 Jun 12, 2022
An App based on MVVM architecture to track & store a user's runs using Google Maps, with options to view & sort the runs as per the user's choice along the with option to run the app in background.

An App based on MVVM architecture to track & store a user's runs using Google Maps, with options to view & sort the runs as per the user's choice along the with option to run the app in background.

Harshit Maheshwari 1 Jun 9, 2022
MovieTray - An application built to play around JetPack components.

Its a playground application focusing on Paging3, MVVM architecture, Kotlin Extension functions, Retrofit, DSL, Navigation component, MotionLayout, SharedElementTransition, Single Activity Architecture, DataStore etc.

Niharika Arora 98 Nov 15, 2022
SnapChat-Clone - The android studio project for a snapchat clone for android devices

SnapChat-Clone This is the android studio project for a snapchat clone for andro

Ujjwal Sharma 0 Jan 30, 2022
School project: Weather forecast application made in android studio using Kotlin, SQLite and OpenWeatherMaps free API.

A*star 4-cast School project made in android studio using Kotlin, SQLite and free API from OpenWeatherMap.org. A weather forecast app with C(U)RD oper

Felicia Olsson 2 Apr 3, 2022
A simple hello word Android Studio project for Haxe/Heaps

Heaps Android - Hello World An Android Studio project for a simple Heaps.io Hello World. I'm probably not maintaining this, but it may work and if not

null 18 Nov 30, 2022
Cody Engel 2 Apr 20, 2022
Run yolov5s on Android device!

The implementation of yolov5s on android for the yolov5s export contest.

null 203 Dec 23, 2022