timfreiheit / resourceplaceholdersplugin Goto Github PK
View Code? Open in Web Editor NEWuse manifest placeholders in android resources
License: MIT License
use manifest placeholders in android resources
License: MIT License
Using ${applicationId} works fine, but when I define my own variables like
android {
...
buildTypes.all {
manifestPlaceholders = [exportDebugFeatures: "$debuggable"]
}
}
And use it in my shortcuts.xml
:
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="debugActivity"
android:enabled="${exportDebugFeatures}"
android:icon="@drawable/ic_debug"
android:shortcutShortLabel="@string/app_shortcut_debug">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="${applicationId}"
android:targetClass="com.rise.app.wallet.debug.DebugActivity" />
<!-- If your shortcut is associated with multiple intents, include them
here. The last intent in the list determines what the user sees when
they launch this shortcut. -->
<categories android:name="android.shortcut.conversation" />
</shortcut>
<!-- Specify more shortcuts here. -->
</shortcuts>
build.gradle
resourcePlaceholders {
files = ['xml/shortcuts.xml']
}
It wont't get resolved
AGPBI: {"kind":"error","text":"error: \u0027${exportDebugFeatures}\u0027 is incompatible with attribute android:enabled (attr) boolean.","sources":[{"file":"...\\app\\build\\generated\\res\\resourcesPlaceholders\\....\\debug\\xml\\shortcuts.xml"}],"original":"","tool":"AAPT"}
..\app\build\generated\res\resourcesPlaceholders\...\debug\xml\shortcuts.xml:0: error: '${exportDebugFeatures}' is incompatible with attribute android:enabled (attr) boolean.
error: failed linking file resources.
Right now the user has to guess how it works in details. Provide a full minimal example on how to use it (like in your SO answer) e.g.
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
...>
<intent
android:action="android.intent.action.VIEW"
android:targetClass="com.test.MainActivity"
android:targetPackage="${applicationId}"/>
</shortcut>
Hi, after upgrading AGP from 7.4.1 to 8.0.0 I'm getting this error:
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> Could not create task ':app:resourcePlaceholdersForProductionGoogleDebug'.
> Cannot use @TaskAction annotation on method ResourcePlaceholdersTask.execute() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.
> Could not set unknown property 'enabled' for Report xml of type org.gradle.api.reporting.internal.TaskGeneratedSingleFileReport.
Relevant part of the stacktrace:
at de.timfreiheit.plugin.resourceplaceholders.ResourcePlaceholdersPlugin.configureAndroid(ResourcePlaceholdersPlugin.kt:82)
at de.timfreiheit.plugin.resourceplaceholders.ResourcePlaceholdersPlugin.access$configureAndroid(ResourcePlaceholdersPlugin.kt:17)
at de.timfreiheit.plugin.resourceplaceholders.ResourcePlaceholdersPlugin$configure$1.execute(ResourcePlaceholdersPlugin.kt:57)
Hi,
Thanks for creating this plugin!
I have recently been seeing the below warnings from gradle. I think they started after upgrading to Gradle 7.0, and they are still visible with Gradle 7.2.
Doesn't affect any functionality, but might be good to address the warnings.
> Task :app:extractDeepLinksAppNameRelease
Execution optimizations have been disabled for task ':app:extractDeepLinksAppNameRelease' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: 'app/build/generated/res/resourcesPlaceholders/AppName/release/navigation'. Reason: Task ':app:extractDeepLinksAppNameRelease' uses this output of task ':app:resourcePlaceholdersForAppNameRelease' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
Execution optimizations have been disabled for 2 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
It'd nice if the plugin is available in the Gradle plugin portal, so we can apply the plugin with the plugins DSL. Thanks ๐
Please :)
Hi @timfreiheit !
First of all, thank you for great work here. We're using this plugin on @adidas to help us with multi-flavor projects.
Today I was facing a problem in one of our builds and I manage to understand that replacement of placeholders isn't working anymore.
From google issuetracker I see the APIs have change and this project needs to be update. I see that you activity are null since 2021, do you still supporting the project?
You can find more details here.
Thanks in advance.
I've reverse engineered a production build and have seen that ${applicationId} is kept as it is in the shortcuts.xml (but works when running debug build).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.