Calling ionic/capacitor bridge from another android app - ionic-framework

I have created the ionic/capacitor project and generated .aar file to distribute to another android app. But while calling activity from third party app's MainActivity.java getting the below error,
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/getcapacitor/BridgeActivity;
Calling the activity in the following way,
Intent myIntent = new Intent(view.getContext(), io.ionic.starter.MainActivity.class);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
view.getContext().startActivity(myIntent);

Related

Why SAPUI5 Page is not Loading and my local sapui5 projects having ModuleError?

Flexible Programming Model Explorer from Tools - Demo Kit - SAPUI5 SDK
I can't access this url. At the same time, I cannot enter local projects that I created with VSCode. The error I get in both is common.
I'm generating new projects with latest version of Fiori tools. I'm sure there is no problem with project and that url. Why my browsers (Chrome, Edge, Firefox) cant launch these sites.
I also checked that website via Browserling. Thats OK.
This is the console log.
Failed to load component for container container - ModuleError: Failed to resolve dependencies of 'sap/fe/templates/library.js'
-> 'sap/fe/macros/library.js'
-> 'sap/fe/macros/filter/type/MultiValue.js'
-> 'sap/fe/macros/filter/type/Value.js': failed to execute module factory for ''sap/fe/macros/filter/type/Value.js'': U is not a function
ModuleError: Failed to resolve dependencies of 'sap/fe/templates/library.js'
-> 'sap/fe/macros/library.js'
-> 'sap/fe/macros/filter/type/MultiValue.js'
-> 'sap/fe/macros/filter/type/Value.js': failed to execute module factory for ''sap/fe/macros/filter/type/Value.js'': U is not a function
at p1 (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:53:213)
at j1.failWith (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:40:43)
at https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:65:1556
Caused by: ModuleError: failed to execute module factory for ''sap/fe/macros/filter/type/Value.js'': U is not a function
at p1 (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:53:213)
at j1.failWith (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:40:43)
at https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:65:1205
Caused by: TypeError: U is not a function
at https://sapui5.hana.ondemand.com/resources/sap/fe/macros/library-preload.js:370:10
at https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:65:1013

Why the app produced by flutter build web sometimes doesn't work?

I have 2 issues that only appear when executing flutter build web.
Sometimes flutter build web fails complaining (wrongly) about types that were not compatible (see below).
Sometimes the build process finishes but then the web app doesn't work: doesn't display anything and there are no messages in the console.
The error I mention is something like this:
% flutter build web
Target dart2js failed: Exception: lib/main.dart:24:31:
Error: A value of type 'ApiUsersRepository' can't be assigned to a variable of type 'UsersRepository'.
- 'ApiUsersRepository' is from 'package:my_app/api_users_repo.dart' ('lib/api_users_repo.dart').
- 'UsersRepository' is from 'lib/users_repo.dart'.
final UsersRepository usersRepository = ApiUsersRepository();
^
Error: Compilation failed.
The app is working in iOS and web when developing.
The solution
I changed all imports of my files like:
import 'package:my_app/users_repo.dart';
To:
import 'users_repo.dart';
More Details
Investigating the error about types, I found this issue, where the important part is this comment: after changing every import to relative format it resolves my problem.
So I did that, and it solved the 2 issues, the compilation error, and the runtime error.
for me I had to remove a package that was corrupted. c:\src\flutter.pub-cache\hosted\pub.dartlang.org\localstorage-4.0.0+1 Apparently, a file had become corrupted by me invertly. I removed the package and did a flutter pub get then recompiled and it worked.

FB.Init() error during gradle build unity

I am using Unity 2018.1.6f1 and facebook-unity-sdk-7.13.0. When I try to build the project using gradle, the build is completed successfully but it gives an error while calling FB.Init()
"AndroidJavaException: java.lang.ClassNotFoundException:
com.facebook.unity.FB".
I tried the solution in the following links:
Android ProGuard settings for Facebook
I even checked whether I was using debug keyhash, which I was, but I addded release key hash and still getting the same error.
Any help would be appreciated.
P.S. It works fine in debug build
On Android publishing settings section (in the place you set the keystore stuff), there is a checkbox for User ProGuard file (at least if you are on Gradle). If you check it, Unity will make such file and put it in the project.
Then, on the proguard file, I added:
-keep class com.facebook.** { *; }
-keepattributes Signature
And that seems to be all!
Then I see the FB SDK initing properly both on Debug and Release:
Hope it works for you as well.

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.

Bundling app with SystemJS using 3rd party library?

How can I get the systemjs builder to ignore third party libraries? We are evaluating wijmo controls for use in an app and they provide wijmo.angular2.min.js, wijmo.input.min.js and wijmo.min.js. We load these after SystemJS in our web page and that works fine because those files register the wijmo modules. However, when we try to bundle it throws an error because it cannot find the files. Sample error:
Unhandled rejection Error on fetch for vendor/wijmo/wijmo.angular2.input.js
at file:///C:/git/prj/dist/vendor/wijmo/wijmo.angular2.input.js
I can add this path to my config but then I get a different error:
'wijmo/*': 'vendor/wijmo/wijmo.angular2.min.js'
Error:
Unhandled rejection TypeError: Error compiling register module "wijmo/wijmo.angular2.input"
at vendor\wijmo\wijmo.angular2.min.js
Source vendor\wijmo\wijmo.angular2.min.js is already a bundle file, so can't
be built as a module.
Edit
Adding this path lets bundling work (at least it builds the bundles), but keeping the line in my config causes the app to error out, apparently being unable to find the class I'm importing (throws unexpected directive 'undefined')...
'wijmo/wijmo.angular2.input': 'vendor/wijmo/wijmo.input.min.js'
I got it to work by adding a 'meta' section to my SystemJS config that told it not to build that path:
var meta = {
'wijmo/*': {
format: 'global',
build: false,
}
};