Is it no longer possible to build an Android app with Wappler?

@kfawcett Ah yes, when I use Gradle 7.4.2 I then get an error saying minimum gradle version required is 7.5…then if I go to a higher version, the error says minimum 7.6 and so on, then when I get all they way up to 8, the namespace error comes up

welp… I’m getting an error now as well. It’s been about a month since I worked on Android, so something has definitely changed.

[info] Found 1 Capacitor plugin for android:
       @capacitor-community/sqlite@4.6.3
√ update android in 319.11ms
× Running Gradle build - failed!
[error] Starting a Gradle Daemon (subsequent builds will be faster)
        
        > Configure project :app
        WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats.
        
        > Configure project :capacitor-cordova-android-plugins
        WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats.
        
        > Task :app:preBuild UP-TO-DATE
        > Task :app:preDebugBuild UP-TO-DATE
        > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
        > Task :capacitor-android:preBuild UP-TO-DATE
        > Task :capacitor-android:preDebugBuild UP-TO-DATE
        > Task :capacitor-android:compileDebugAidl NO-SOURCE
        > Task :capacitor-community-sqlite:preBuild UP-TO-DATE
        > Task :capacitor-community-sqlite:preDebugBuild UP-TO-DATE
        > Task :capacitor-community-sqlite:compileDebugAidl NO-SOURCE
        > Task :capacitor-cordova-android-plugins:preBuild UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:preDebugBuild UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:compileDebugAidl NO-SOURCE
        > Task :app:compileDebugAidl NO-SOURCE
        > Task :capacitor-android:packageDebugRenderscript NO-SOURCE
        > Task :capacitor-community-sqlite:packageDebugRenderscript NO-SOURCE
        > Task :capacitor-cordova-android-plugins:packageDebugRenderscript NO-SOURCE
        > Task :app:compileDebugRenderscript NO-SOURCE
        > Task :app:generateDebugBuildConfig UP-TO-DATE
        > Task :app:javaPreCompileDebug UP-TO-DATE
        > Task :capacitor-android:writeDebugAarMetadata UP-TO-DATE
        > Task :capacitor-community-sqlite:writeDebugAarMetadata UP-TO-DATE
        > Task :app:generateDebugResValues UP-TO-DATE
        > Task :app:generateDebugResources UP-TO-DATE
        > Task :capacitor-android:compileDebugRenderscript NO-SOURCE
        > Task :capacitor-android:generateDebugResValues UP-TO-DATE
        > Task :capacitor-android:generateDebugResources UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:writeDebugAarMetadata
        > Task :capacitor-android:packageDebugResources UP-TO-DATE
        > Task :capacitor-community-sqlite:compileDebugRenderscript NO-SOURCE
        > Task :capacitor-community-sqlite:generateDebugResValues UP-TO-DATE
        > Task :capacitor-community-sqlite:generateDebugResources UP-TO-DATE
        > Task :capacitor-community-sqlite:packageDebugResources UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:compileDebugRenderscript NO-SOURCE
        > Task :capacitor-cordova-android-plugins:generateDebugResValues
        > Task :capacitor-cordova-android-plugins:generateDebugResources
        > Task :capacitor-cordova-android-plugins:packageDebugResources
        > Task :app:mergeDebugResources UP-TO-DATE
        > Task :app:mapDebugSourceSetPaths
        > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
        > Task :app:extractDeepLinksDebug
        > Task :capacitor-android:extractDeepLinksDebug
        > Task :app:checkDebugAarMetadata FAILED
        > Task :capacitor-android:processDebugManifest

        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':app:checkDebugAarMetadata'.
        > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
        > 4 issues were found when checking AAR metadata:

        1.  Dependency 'androidx.room:room-runtime:2.5.0' requires libraries and applications that
        depend on it to compile against version 33 or later of the
        Android APIs.

        :app is currently compiled against android-32.

        Also, the maximum recommended compile SDK version for Android Gradle
        plugin 7.2.1 is 32.

        Recommended action: Update this project's version of the Android Gradle
        plugin to one that supports 33, then update this project to use
        compileSdkVerion of at least 33.

        Note that updating a library or application's compileSdkVersion (which
        allows newer APIs to be used) can be done separately from updating
        targetSdkVersion (which opts the app in to new runtime behavior) and
        minSdkVersion (which determines which devices the app can be installed
        on).

        2.  Dependency 'androidx.sqlite:sqlite-framework:2.3.0' requires libraries and applications that
        depend on it to compile against version 33 or later of the
        Android APIs.

        :app is currently compiled against android-32.

        Also, the maximum recommended compile SDK version for Android Gradle
        plugin 7.2.1 is 32.

        Recommended action: Update this project's version of the Android Gradle
        plugin to one that supports 33, then update this project to use
        compileSdkVerion of at least 33.

        Note that updating a library or application's compileSdkVersion (which
        allows newer APIs to be used) can be done separately from updating
        targetSdkVersion (which opts the app in to new runtime behavior) and
        minSdkVersion (which determines which devices the app can be installed
        on).

        3.  Dependency 'androidx.sqlite:sqlite:2.3.0' requires libraries and applications that
        depend on it to compile against version 33 or later of the
        Android APIs.

        :app is currently compiled against android-32.

        Also, the maximum recommended compile SDK version for Android Gradle
        plugin 7.2.1 is 32.

        Recommended action: Update this project's version of the Android Gradle
        plugin to one that supports 33, then update this project to use
        compileSdkVerion of at least 33.

        Note that updating a library or application's compileSdkVersion (which
        allows newer APIs to be used) can be done separately from updating
        targetSdkVersion (which opts the app in to new runtime behavior) and
        minSdkVersion (which determines which devices the app can be installed
        on).

        4.  Dependency 'androidx.security:security-crypto:1.1.0-alpha05' requires libraries and applications that
        depend on it to compile against version 33 or later of the
        Android APIs.

        :app is currently compiled against android-32.

        Also, the maximum recommended compile SDK version for Android Gradle
        plugin 7.2.1 is 32.

        Recommended action: Update this project's version of the Android Gradle
        plugin to one that supports 33, then update this project to use
        compileSdkVerion of at least 33.

        Note that updating a library or application's compileSdkVersion (which
        allows newer APIs to be used) can be done separately from updating
        targetSdkVersion (which opts the app in to new runtime behavior) and
        minSdkVersion (which determines which devices the app can be installed
        on).

        * 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 11s
        19 actionable tasks: 8 executed, 11 up-to-date

Error running your project for android!

@kfawcett ouch! That sucks. Thank you so much for trying to help me on this. There has to be a solution somewhere.

Hopefully @George or @Teodor can shed some light on this

I managed to get it to launch by updating the following properties in variables.gradle from 32 to 33. Still, not going to fix your issue though.

   compileSdkVersion = 33
    targetSdkVersion = 33

Hi Keith,

Are you able to build and successfully run the emulator in Wappler?

I can work on my app and send to the app store successfully, but I have to build and use the emulator in Android Studio.

What version do you have in build.gradle dependcies? Maybe you could use 7.2.1 like I have below?

image

  classpath 'com.android.tools.build:gradle:7.2.1'
  classpath 'com.google.gms:google-services:4.3.13'

Hey Brad, yes, I am able to build and run via Wappler.

1 Like

Did you get that to work? I kept getting an error that says minimum version of Gradle required is 7.5

Hey @cgrulke, can you answer this?

@kfawcett When I tried 7.2.1 and each of the other versions (I tried them all) I kept getting an error saying minimum Gradle version required 7.5. Then when I install 7.5 I get the same error saying 7.6 is required.

Right now I am thinking this is a problem with Android Studio Flamingo. I have completely uninstalled it and will tinker with older versions. Im not sure if it will work but I can’t think of anything else to try. I’ll let you know how it goes.

Did you make the change in the build.gradle file or gradle-wrapper.properties? I don’t know if changing either will work, just curious about what happens for each.

That may be the issue, I’m running Electric Eel.

2 Likes

Sorry, missed that discussion.
Yes, Flamingo causes problems…
Eel works.
(Haven’t updated yet my AS)

1 Like

@HeikoK So Ive tried electric eel and Im still getting the same problem.

@George @Teodor has there been any developments on running a Wappler app on the Android emulators? Apparently there have been some changes to Gradle and AS that make the Wappler Docs on the subject obsolete.

Hi All,

Change to the following:-

classpath ‘com.android.tools.build:gradle:7.2.1’
classpath ‘com.google.gms:google-services:4.3.13’

and using Electric Eel Solved the issue and able to run in simulator successfully.

1 Like

android-studio-2022.1.1.19-windows - This is the version I used.

1 Like

The latest version 5.8.1 seems not that stable… I use back V 5.2.5 and everything work fine like before… Just for info…

1 Like

I am still running into errors. I cannot get the app to run

@phan @kfawcett @HeikoK @brad

Thank you all so much for taking the time to work with me on this. I found a solution and wanted to share. I spent weeks ripping my hair out over this and am stoked to have finally figured it out.

  1. Upgrade to AS Flamingo (I know, many of us thought this was the problem, but stick with me here)
  2. Install SDK 33 (not 31 like Wappler docs say, and not 34 which is the default). Also make sure you have command line tools installed and your desired emulators set up. Also make sure you have downloaded the disk images from the SDK package.
  3. Open the Android folder from your Wappler project in Android Studio (if you haven’t added it from Wappler yet, do so now. Or if you already have, delete it and re-add it to your Wappler project so you can start fresh.
  4. Under project structure set Android Gradle Plugin Version to 7.4.2
  5. Then set Gradle version to 7.5 (this will get you past the namespace error)

Now at this point to project will build but will not run. When you try to run you will likely get the duplicate classes error. This is something dumb in Kotlin. but I have a hacky fix here:

  1. Open your build.gradle (Module :app) file (NOT build.gradle (Project :android)…important distinction)
  2. Paste the following code at the very bottom of that file

configurations.implementation {
exclude group: ‘org.jetbrains.kotlin’, module: ‘kotlin-stdlib-jdk8’
}

  1. Sync, build in AS and run from AS or Wappler.

The app should now run on the emulator and you should be able to launch it from Wappler

Please note that I am on a Mac M1 and my project is using Capacitor 5.0.5 on a node.js and BS5 mobile app project.

If anyone is still stuck with this, please feel free to reach out.

1 Like

How to set above? Thanks

So in Wappler add Android to your project so it creates an Android folder in your project folder.

Then open the Android folder in Android Studio (Don’t open the entire project folder in AS, just the Android folder. Should look like this.

Then in AS go to file>Project Structure

Then from the drop-down select the plugin and Gradle version