Where to specify namespace when packaging an android app through gluon - android

When trying to package an android app using Gluon (mvn gluonfx:package -Pandroid) I face the following error:
Execution failed for task ':app:generateDebugBuildConfig'.
Error while evaluating property 'applicationId' of task ':app:generateDebugBuildConfig'
Failed to calculate the value of task ':app:generateDebugBuildConfig' property 'applicationId'.
> Failed to query the value of property 'applicationId'.
> Package Name not found in /home/argentum/myApp/target/gluonfx/aarch64-android/gvm/android_project/app/src/main/AndroidManifest.xml, and namespace not specified. Please specify a namespace for the generated R and BuildConfig classes via android.namespace in the module's build.gradle file like so:
android {
namespace 'com.example.namespace'
}
I'm not too familiar with android and gradle but I tried to create the build.gradle file and specified the namespace as the error suggested but this made no difference. Where am I meant to specify the namespace?
I've consulted https://docs.gluonhq.com/#platforms_android_distribution_manifest and https://developer.android.com/studio/build/configure-app-module#set-namespace but I wasn't able to find the answer.

Related

Unable to clean or build my android project after adding custom task in my gradle , seems like some conflict with Kotlin Multiplatform dependency

I need to add one custom task as per this answer and it works completely fine in case of a sample project I have created, but in my main project I am getting error even when I try to clean the project.
In my main project, error seems like Kotlin Multiplatform Module is not able to build and produce a jar file.
Please find the error below
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform KotlinMultiplatformModule.jar (project :KotlinMultiplatformModule) to match attributes {artifactType=android-filtered-proguard-rules, codeShrinker=R8, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, org.jetbrains.kotlin.localToProject=public, org.jetbrains.kotlin.platform.type=jvm}.
> Execution failed for JetifyTransform: path_to_module/build/libs/KotlinMultiplatformModule.jar.
> Transform's input file does not exist: /path_to_module/build/libs/KotlinMultiplatformModule.jar. (See https://issuetracker.google.com/issues/158753935)
Please note I have replaced my Kotlin Multiplatform module name.
Do I need to add some other task to get the jar build first ?
Or I might be completely out of the context here.

Gradle build failure when packaging GooglePAD asset packs in Unreal Engine

I have followed this guide to implement the GooglePAD plugin in UE 4.27, but I'm met with the following error when I try to package the project for the second time (first time generates the asset packs):
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:assetPackDebugPreBundleTask'.
> Could not resolve all task dependencies for configuration ':app:assetPackFiles'.
> Could not resolve project :assetpacks:on-demand:OnDemandPack.
Required by:
project :app
> Project :app declares a dependency from configuration 'assetPackFiles' to configuration 'packElements' which is not declared in the descriptor for project :assetpacks:on-demand:OnDemandPack.
I see that there is a similar question here, but their solution doesn't seem to apply to me since I'm certain my folders are properly named. This happens with all 3 of my on-demand packs. The build.gradle file inside the asset pack folders is exactly the same as the one included in the guide, though I have tried just writing the pack names as shown here to no avail.
What should I do to build successfully with this plugin?

Error on changing "buildToolsVersion" of project in Android Studio

I use Android Studio 3.1.4 and android gradle plugin version 3.1.4.
Previously I set buildToolsVersion "27.0.3" in build.gradle of module and there was no problem in building/running. Today I installed newer version of build tools and change build.gradle to use that: buildToolsVersion "28.0.2"
But when I try to sync project with gradle files or rebuild project it ends with AAPT2 error:
AGPBI: {"kind":"error","text":"error: \u003citem\u003e inner element must either be a resource reference or empty.","sources":[{"file":"<path to module>/src/main/res/values/ids.xml","position":{"startLine":16,"startColumn":4,"startOffset":752,"endColumn":55,"endOffset":803}}],"original":"","tool":"AAPT"}
....
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':<modulee-name>:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
But I do not understand what causes the error. For example addressed line in error is:
<item type="id" name="bookmark">false</item>
What causes this error and how I can solve this problem?
Edit
I added android.enableAapt2=false to the gradle.properties and it seems ignores error, but causes this warning:
The option 'android.enableAapt2' is deprecated and should not be used
anymore. Use 'android.enableAapt2=true' to remove this warning. It
will be removed at the end of 2018..
you cannot assign false (nor any other value but it's name) to an ID resource.
An ID is a simple resource that is referenced using the value provided in the name attribute (not the name of the XML file). As such, you can combine ID resources with other simple resources in the one XML file, under one element. Also, remember that an ID resources does not reference an actual resource item; it is simply a unique ID that you can attach to other resources or use as a unique integer in your application.
with android.enableAapt2=false it might ignore the logical error, but not "fix it".

Gradle build fails after adding core ktx

When I add the core-ktx dependency to my app's build.gradle file, my gradle builds fail with the error message AAPT2 error: check logs for details
It furthermore tells that there are two attributes missing in values.xml. This file is located under the .gradle folder inside my user directory.
when I add android.enableAAPT2=false to my project properties, the build fails due to that option being deprecated so I want to avoid that.
The error descriptions of the two resource not found errors are the following:
error: resource android:attr/fontVariationSettings not found.
Message{kind=ERROR, text=error: resource android:attr/fontVariationSettings not found., sources=[C:\Users\Marc.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\b6d4f8d4d33639ae469eaec181e24176\res\values\values.xml], original message=, tool name=Optional.of(AAPT)}
When I add different ktx libraries everything is just fine. It builds properly and I can even import androidx.collections! How can I add the core-ktx library without any errors?
You are using 'AndroidX' which is only available if you set your compileSdkVersion 'android-P' and targetSdkVersion 28. Then in AndroidStudio go to Refactor -> Refactor to AndroidX and everything should work fine now :).

duplicate attribute AAPT2 link failed in feature Module in Instant app

I am following google codelab for instant app. After I convert the original app to baseFeature and added another feature module which will then act like the application but will be based on the original baseFeature.
As per told in code lab, I changed the buld.gradle files and deleted the application component from the feature Module (Non Base module). When I try to build the project I get the follow error.
Error:(4) duplicate attribute
Error:/home/adventure/Desktop/android-topeka/topekaapk/build/intermediates/manifests/full/debug/AndroidManifest.xml:4 duplicate attribute
Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:Execution failed for task ':topekaapk:processDebugResources'.
> Failed to execute aapt
I got stabbed in my back by lint , YES LINT
Problem : As shown in the image Lint gave an warning for optimizing the import and I removed the xmlns property from manifest.
Solution : Do not delete the xmlns property

Categories

Resources