by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Russell Keith-Magee
    @freakboy3742
    @t-arn Well congratulations - you're now an Open Source contributor! May it be the first of many contributions!
    Tom
    @t-arn
    :-)
    owenloveclaire
    @owenloveclaire

    Hello folks, I'm fairly new to this setup but please bear with me:

    After running the command briefcase create android, which generates a Gradle project without building it, I want to be able to build it myself for the following reasons:

    • I already have the build tools/platform tools/API/etc. lying somewhere in my drive
    • I want to resolve the dependencies myself
    • Gradle downloads a bunch of slightly unnecessary stuff (and Gradle itself is probably unnecessary)
    • and most importantly, I want to gain insight into how Beeware and Android compiling/building/packaging in general works

    In regular Android dev, I suppose it's aapt + javac + dx + aapt + apksigner + zipalign. However, with the presence of Python, C/C++, and Kotlin, I'm not so sure.

    Is there a tutorial/guide/list of steps I could follow on how to build Beeware apps in Android without using briefcase build android or Gradle?

    بوكن دين
    @bebolapi_twitter
    helo help me
    im on tutorial 2 i dknow where to make interesting part when add the code
    im stuck there
    بوكن دين
    @bebolapi_twitter
    someone help
    Deyspring
    @Deyspring
    @bebolapi_twitter Right now it's hard to know where you are stuck from the information you have typed here. Explain the problem out loud like you're telling someone else. This will help you come up with a clearer explanation of the problem. Once you have done this, explain to us where you are stuck again and hopefully someone will be able to help you.
    Also, it's totally normal to be stuck when you're starting out.
    Olga Bulat
    @obulat
    @t-arn Congratulations on your first contribution! :)
    owenloveclaire
    @owenloveclaire

    I found my module's build.gradle file:

    android {
        compileSdkVersion 29
        defaultConfig {
            applicationId "com.example.helloworld"
            minSdkVersion 21
            targetSdkVersion 29
            versionCode 100
            versionName "0.0.1"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            externalNativeBuild {
                cmake {
                    cppFlags "-std=c++14"
                }
            }
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
        externalNativeBuild {
            cmake {
                path "src/main/cpp/CMakeLists.txt"
                version "3.6.0+"
            }
        }
        sourceSets {
            main {
                jniLibs.srcDirs = ['libs']
            }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'androidx.appcompat:appcompat:1.0.2'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test.ext:junit:1.1.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
        implementation files('libs/rubicon.jar')
        implementation "androidx.core:core-ktx:+"
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    }
    repositories {
        mavenCentral()
    }

    I could probably do away with the testing (and I probably don't need maven), but none of this script tells me how to build it, like actual commands in the terminal.

    Can anyone give me any guidance?

    Olga Bulat
    @obulat
    By the way, I believe currently winforms webview uses Internet Explorer 6 engine, so it really needs updating. Denfromufa, former maintainer of Pythonnet, advised me to look into pywebview and how they implement winforms webview using Microsoft.Toolkit.Forms.UI.Controls.WebView.
    Olga Bulat
    @obulat
    Does Toga work fine on Ubuntu 20.04? I tried installing it on my Windows Subsystem for Linux which has Ubuntu 20.04, and couldn't install the last two requirements:
     sudo apt-get install  libpango1.0-dev libwebkitgtk-3.0-0 gir1.2-webkit-3.0
    [sudo] password for <>:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Package libwebkitgtk-3.0-0 is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    
    E: Package 'libwebkitgtk-3.0-0' has no installation candidate
    E: Unable to locate package gir1.2-webkit-3.0
    E: Couldn't find any package by glob 'gir1.2-webkit-3.0'
    E: Couldn't find any package by regex 'gir1.2-webkit-3.0'
    dgelessus
    @dgelessus
    @owenloveclaire I don't know very much about Android development, but I do know Gradle in general relatively well - perhaps this will help a bit.
    If you want to get some insight into what Gradle does internally while running your build, you can pass the --info flag to the Gradle command (or --debug, but that generates a lot of information and is not very readable). But you should be aware that (unlike Makefiles for example) Gradle scripts don't directly map to a sequence of shell commands. For example, resolving and downloading dependencies, copying files around, creating archives, etc. is done directly using standard Java APIs and libraries. The Java compiler is also (at least sometimes) called through its own Java API instead of the command line.
    Of course that doesn't mean that you can't build an Android project manually from the command line without Gradle - there's probably a sequence of commands that you can run to get the same result as the Gradle build. But the question is what you want to achieve with that. If you want to learn how the build of an Android app works internally, this isn't a very good approach, because (as explained above) Gradle doesn't just run a sequence of shell commands. If you want to keep your build process simple, then Gradle and Maven Central aren't the things you want to remove - downloading all your dependencies manually will be a lot more complex and error prone than having Gradle pull them automatically from Maven Central.
    dgelessus
    @dgelessus

    Also I just saw that you mentioned this point above:

    • I already have the build tools/platform tools/API/etc. lying somewhere in my drive

    Can you elaborate which tools/SDKs you mean exactly? Briefcase will by default download a JDK and Android SDK, but it should be possible to override that and have it use existing installations, by setting the JAVA_HOME and ANDROID_SDK_ROOT envvars to the correct paths. Gradle will automatically download itself (through the Gradle wrapper) and the JVM deps listed in the build.gradle, but those will be cached and shared across all Gradle builds on your system, so there should be no duplicate installations there.

    Russell Keith-Magee
    @freakboy3742
    @owenloveclaire The project generatated by Briefcase is a stock Gradle project, with the same build targets as an Android Studio gradle project; so, you can get the available build tasks with ./gradlew tasks, and you can build a debug build with ./gradlew buildDebug.
    To the best of my knowledge, it only downloads what it needs, however. That's is, unfortunately, a lot of stuff.
    If you've already got an Android Studio install downloaded, as @dgelessus said, if you set ANDROID_SDK_ROOT and JAVA_HOME, briefcase will use those versions of the tools.
    If it is downloading something that isn't needed - patches welcome :-)
    Russell Keith-Magee
    @freakboy3742
    @obulat Toga does work with Ubuntu 20.04; the system dependencies are slightly different, though. libwebkit2gtk-4.0-37 gir1.2-webkit2-4.0 are the two that are causing problems here.
    The Toga README has those dependencies listed, as does the Briefcase tutorial; have we missed a list somewhere?
    Olga Bulat
    @obulat
    I was reading the "How to contribute to Toga" at https://toga.readthedocs.io/en/latest/how-to/contribute.html :) because that page has instructions for testing.
    Russell Keith-Magee
    @freakboy3742
    Ah - right - we need to update that, then. Ubuntu 18.04 and 20.04 are "debian 10" analogs. We flag this better in the README; we should probably update the docs to make the same distinction.
    Olga Bulat
    @obulat
    Wow, that needs additional 495Mb of space on my computer...
    بوكن دين
    @bebolapi_twitter
    @Deyspring hey there im want to experience creating an apps
    so i followed tutorial on beeware.im kind stuck at [tutorial 2 - Making it interesting]
    in this part it shows all code to make my apps more content,i think u can go there so u will understand my problems.my question is how can i add content or all code stuff and excute the code to make my apps.where to put the code, at command prompt or what?
    link:https://docs.beeware.org/en/latest/tutorial/tutorial-2.html
    adityabhaskar89
    @adityabhaskar89
    Hey, how do I add text? Like if I wanna display "welcome" or something else in a new window, when I click on a button.....How do I do that? Can't find the syntax anywhere....
    Russell Keith-Magee
    @freakboy3742
    @bebolapi_twitter The tutorial you've linked to says what file you need to edit, and where to put the code. For example: "Modify the HelloWorld class inside src/helloworld/app.py".
    @adityabhaskar89 Have you done the tutorial? Because the tutorial pretty much does exactly what you've described
    adityabhaskar89
    @adityabhaskar89
    @freakboy3742 , I have done the tutorial. In the tutorial, when a button is clicked, the message is printed in the command prompt. Instead, I want in to be printed on the Toga window.
    Russell Keith-Magee
    @freakboy3742
    Which tutorial are you working through?
    Russell Keith-Magee
    @freakboy3742
    Right - so keep going. The next pages of the tutorial alter what the demo does.
    adityabhaskar89
    @adityabhaskar89
    I went through the rest of the pages, I couldn't find what I wanted anywhere.
    Russell Keith-Magee
    @freakboy3742
    So... which part isn't clear? If it's "set the text of a label"... you do exactly that. You can set the label when you construct the label with mylabel = toga.Label('content'), or once the label instance already exists, mylabel.text = "new content"
    adityabhaskar89
    @adityabhaskar89
    Oh! So that's what it does....Thanks for explaining it to me.
    Aristide99
    @Aristide99
    hello at you, when i start a new project as in the official documentation i got this error in man.py : Cannot find reference 'app' in 'init.py'
    Russell Keith-Magee
    @freakboy3742
    @Aristide99 Are you following a tutorial? And if so, which one, and how far through have you gotten when you get that error?
    Aristide99
    @Aristide99
    @freakboy3742 Yes I am new, and I have fully followed the tutorial on https://docs.beeware.org/en/latest/tutorial/tutorial-1.html without changing anything, I get this error when I click on main. py
    Russell Keith-Magee
    @freakboy3742
    If you’re on main.py, you’re not following the tutorial. There’s nothing in the tutorial that tells you to click on anything to start the app.
    Aristide99
    @Aristide99
    @freakboy3742 I'm not saying that I have to click on man.py to start the application but when I click to see the code

    ``` from helloworld.app import main

    if name == 'main':
    main().main_loop()
    ```

    @freakboy3742 this is what I see in main.py with the error Cannot find reference 'app' in 'init.py'
    Russell Keith-Magee
    @freakboy3742
    No, you dont have to click on main.py to start the app. The tutorial does not tell you to click on main.py. It does, however, tell you to run ‘briefcase dev’ from the command line.
    Aristide99
    @Aristide99
    @freakboy3742 OK well noted
    Alaaf
    @Alaaf05075311_twitter
    Hello Russell, thanks for making the suite up. It is so great! The tutorial is clean and tidy.
    I have started making my little apps at android. It use , Pandas , Numpy , requests, smtp. I could build and run using briefcase for windows. But when i use briefcase for android, it just cannot run. May i know how could it troubleshoot this? I seems that the app package was not generated. I guess some of the python import may not work at this stage. It's good if i could be directed to the supported list.
    Russell Keith-Magee
    @freakboy3742
    @Alaaf05075311_twitter Yes - any package with a binary component will have difficulty at this time. This includes most of the numpy/Scipy ecosystem. Addressing this is on our todo list.
    The problems only exist on mobile platforms - iOS and Android.
    Alaaf
    @Alaaf05075311_twitter
    Good, so at this stag, i could play around by making a call to server side to do the python data stuff . One more question, i would like to know if background service of android (i.e. when the app is idle) is supported in current beeware version? Many thanks :)
    Russell Keith-Magee
    @freakboy3742
    Not at present. Background operation isn’t as simple as a background thread; it requires close coordination with the operating system.