Exclude file from apk when building with Soong - android-source

With regular gradle app I am able to exclude a file from apk (native lib specifically) with this, but at the same time keep another native lib called say mylib2.so in the apk.
packagingOptions {
exclude "**/mylib1.so"
}
Is there a possibility to do the same using AOSP Soong build system when describing android_app type of module?
The goal is to have mylib1.so shared among many apps and exclude it, but mylib2.so is app specific and it's better to be in the apk.

Related

dart reflectable in library

I'm making a library for persistence implementation. For that I want to use reflection to be able to restore an object from the storage.
I can't use dart:mirrors because this library will be use also in Flutter application. So I'm trying to use reflectable package. And here I'm getting a major issue with understanding of how it should work. The doc tells reflectable uses build package and that some files must be generated. But I couldn't find anywhere whether this generation should happen for each file in my library package or just those where reflectable is used.
My library project structure is standard:
/examples
/lib
/lib/src
/lib/my_package.dart
/test
/pubspec.yaml
When I run dart run build_runner or dart run build_runner lib from the project root I see for each file in /example and /tests a matching file is generated. But in /lib folder nothing is generated. Only file where I'm intending to use reflectable is /lib/src/persistence/persistence_model.dart. I've created a file /lib/build.yaml of following content:
targets:
$default:
builders:
reflectable:
generate_for:
- src/persistence/persistence_model.dart
options:
formatted: true
but it seems to have no effect.
So, what should be right approach?
And probably a side question or rather consideration: isn't using reflection in Dart and Flutter excessively complex comparing to other languages (Python, C#, Java)?

can we exclude a particular file alone while building apk in flutter

There is 2 product flavour in my project and i do not want some files to be added while building the .apk or app bundle and the below solution is not working .
android {
packagingOptions {
exclude 'lib/widgets/hotel.dart'
exclude 'lib/widgets/hotel_list_view.dart'
exclude 'lib/widgets/hotel_list_data.dart'
exclude 'lib/widgets/smooth_star_rating.dart'
}
}
You do not need to worry about that the files which are not used will automatically removed from the code

Local swift package with local dependency

I have a project that I plan on developing in modules, the final application will be any number of the modules built together based on a configuration. I have a swift package that has all of my common code it it, we can call that the platform package. I then went to create my first feature, this went just fine however when I created the wrapper application to pull in each feature, I got this error from SPM in xcode11:
package 'Platform' is required using a revision-based requirement and it depends on local package
'Feature1', which is not supported.
Looking at the code base for SPM here (line 72)
https://github.com/apple/swift-package-manager/blob/master/Sources/PackageGraph/DependencyResolver.swift
It looks like this is something that is just not supported, the mixing of local and remote dependencies? Is this a limitation of SPM / should I be trying to use another tool for this type of app architecture?
In my case, I was trying to add a package, which I was developing, and its Package.swift contained dependencies of the form:
dependencies: [
.package(path: "../PackageName"),
// etc
Changing the references to specific repos solved the problem:
dependencies: [
.package(path: "http://github.com/..."),
// etc

making sure the polymer build process doesn't mess with a dependency of my element

I have built a custom element/web component to load and display Unity generated WebGL content. The web component imports the UnityLoader.js module - and works fine when used within an app served with 'polymer serve'.
However, when I build an app that uses my web component via the Polymer-CLI build process, no errors are given, but when I access a page using my component I always end up with an error from within UnityLoader.js:
"ReferenceError: BabelHelpers is not defined"
If I create the element directly within my app (in other words it is no longer managed by bower) then I can exclude the minification and compilation steps within the build section of my application's polymer.json file and the built version of the app works fine.
"builds": [
{
"preset": "es5-bundled",
"js": {
"compile": {"exclude": ["content/**/*","UnityLoader.js"]},
"minify": {"exclude": ["content/**/*","UnityLoader.js"]}
},
"html": {
"minify": {"exclude": ["content/**/*"]}
}
}
]
I've looked at my application's polymer.json file and I can see that the extraDependecies node contains some dependencies that other web components have placed there:
"extraDependencies": [
"bower_components/webcomponentsjs/*.js",
"!bower_components/webcomponentsjs/gulpfile.js",
"manifest.json",
"bower_components/plastic-image/intersection-observer.js",
"bower_components/ua-parser-js/dist/ua-parser.min.js"
],
I have UnityLoader.js within the extraDependencies of the element's polymer.json but that isn't getting cascaded up to an application that imports/consumes the element - which I guess must be possible as plastic-image and ua-parser-js have done it (I've looked at their bower_components folders and nothing seems obvious - other than the latter is installed as a dependency of the former).
Any ideas on how I can make sure that the UnityLoader.js that my web component uses is not compiled or minified during the build process of an application that consumes it?
I was having a similar issue with firebase-auth.js when making an ES5 build using polymer-cli 1.7.0. There might be a problem when compiling/minifying specific files. I had to roll back to 1.6.0 using npm install -g polymer-cli#1.6.0 to fix the problem.

Error in Build After InAppPurchase Unity

CommandInvokationFailure: Unable to merge android manifests. See the Console for more details.
C:/Program Files/Java/jdk1.8.0_161\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Sabasoft Developer/Downloads/tools_r25.2.3-windows\tools" -Dfile.encoding=UTF8 -jar "D:\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
stderr[
]
stdout[
Warning: [Temp\StagingArea\AndroidManifest-main.xml:12, D:\unity projects\Pizza maker\Temp\StagingArea\android-libraries\GooglePlay\AndroidManifest.xml:3] Main manifest has but library uses targetSdkVersion='24'
]
exit code: 1
Update Java SdK
Update Android SdK
Check target in menifest file and Unity editor. Both should be same.
Remove duplicate .jar under plugins folder if there are any.
You are using a library somewhere in your code (possibly something for GooglePlay?). The library has a manifest.xml file that is likely located in a folder called plugin or one of its subfolders.
The manifest is the file used by android to describe the app: how it starts, what permissions it has, and so on.
Any android project in unity will include a default manifest.xml file. This file is edited by unity with some info relative to you game (the name, and the target version, are part of it).
Now, the libraries you include in your project might need different options and values in the manifest, so Unity libraries for android usually come with another manifest.xml file. This will will be automatically merged with the default one by unity at build time.
Usually, it goes well, the additional line in the manifest from the library get added to the default manifest.
But in your case, there is a conflict between these manifests. The target version is specified both in the library and in your project. So unity can't resolve it.
To fix this, use a target version for your project that is the same or higher than the one of the library. Edit your target version under player settings