Android Errors

Hi,

Trying to get the Android emulator to work with Android studio and Wappler. Get an error whenever I compile either just in Wappler or in AS. Errors depend on who you follow in the post but never works. I have gone through previous posts on how to solve this. Have started over several times with a simple 1 page app. Works fine on web, and iOS. I see there are many issues with this. Is there a solution to fix this that I am missing something? I am back to using the most recent Android studio (Giraffe).

thanks in advance

Could you please post the error you are getting?

this is one. I tried adding the namespace to build.gradle, but then get several errors.

Namespace not specified. Please specify a namespace in the module’s build.gradle file like so:

android {
namespace ‘com.example.namespace’
}

If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.

Hi!
Had the same issue, what works for me was changing on android studio some values as wappler don’t change it from the settings tab.
(I guess it’s not solved:
App name/version, capacitor/wappler bug, or FR?)

Check the project options tab on android studio.
Will post you a screenshot later.

1 Like

thank you. looking forward to a solution.

Have you tried changing the Application ID from the project structure panel?

In my case, renaming as the same as…:

…works for me

1 Like

thanks for this, but it is in there already.

Now I get this

What gradle version are you using?
Try the 8.0 which I think works fine on that sdk

8.0.0

dependencies {
classpath ‘com.android.tools.build:gradle:8.0.0’
classpath ‘com.google.gms:google-services:4.3.15’

I’m on a Mac M2 chip if that matters
AS Giraffe
Wappler 5.8.2 (and tried 6 beta as well)
web and iOS work just fine

Try updating capacitor, using Wappler v6 as it’s not possible on 5.8.2 (unless manually using the terminal)
https://community.wappler.io/t/updating-capacitor-projects-in-wappler-6/52075

Here is some of the setup of a test apk, running without issues:
(Note that I’m using w10)

Wappler paths:

capacitor.config.json:

package.json:

android/app/build.gradle

On android studio:


Tested and:

Use the build button on wappler, and remember sync the project on A.S.:
image

PS: Tested on beta 8 as I’m not with my main computer, so I’m running this on a notebook.
Will try these days on the latest wappler beta version and check if something is broken.

ok thanks for staying with me on this. updated as instructed. still getting these errors.

Can you show the /app/build.gradle lines?

Hoping I didn’t get worse. I installed a clean version go AS. got the namespace error again. then added the namespace and still errors. here is the build.gradle

new error

There’s two build.gradle, can you show both?

    apply plugin: 'com.android.application'

android {
    namespace "com.mboadmin.app"
    compileSdkVersion rootProject.ext.compileSdkVersion
    defaultConfig {
        applicationId "com.mboadmin.app"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        aaptOptions {
             // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
             // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
            ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    flatDir{
        dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
    implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
    implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
    implementation project(':capacitor-android')
    testImplementation "junit:junit:$junitVersion"
    androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
    androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
    implementation project(':capacitor-cordova-android-plugins')
}

apply from: 'capacitor.build.gradle'

try {
    def servicesJSON = file('google-services.json')
    if (servicesJSON.text) {
        apply plugin: 'com.google.gms.google-services'
    }
} catch(Exception e) {
    logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.0.0'
        classpath 'com.google.gms:google-services:4.3.15'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

apply from: "variables.gradle"

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
{

namespace com.mboadmin.app

}

It appears that this is a problem with Mac. Not sure if it is just Mac m2 chip or Mac in general. Can build on a windows machine ok. Not preferred to run Wappler on 2 different platforms, but until it is resolved I guess that is the only solution.

Wappler gets an error on build.

Note that creating a mobile app directly in android studio works correctly.

This appears to be fixed in Wappler 6 release.

thank you!!