Start Activity Residing Inside Cordova Plugin's Aar's File In Ionic2 Project
Solution 1:
You can definitely invoke full activities inside the aar file. My aar file contained several activities. I have not seen the issue you mentioned, but I have seen path issues when the aar gradle file had problems. You may want to revise your gradle file. This is the one my plugin uses:
repositories{
jcenter()
maven { url "https://jitpack.io" }
flatDir{
dirs 'libs'
}
}
dependencies {
compile'com.android.support:support-v13:23.1.0'compile'com.android.support:support-v4:23.1.0'compile'com.android.support:gridlayout-v7:23.1.1'compile'com.android.support:appcompat-v7:23.1.0'compile'com.android.support:design:23.1.0'compile'com.android.volley:volley:1.0.0'compile'com.google.code.gson:gson:2.4'compile'com.google.android.gms:play-services-base:8.1.0'compile'com.google.android.gms:play-services-location:8.1.0'compile'com.google.android.gms:play-services-maps:8.1.0'compile'com.google.android.gms:play-services-gcm:8.1.0'compile'com.github.bumptech.glide:glide:3.7.0'compile'com.android.support:recyclerview-v7:23.1.0'compile'com.android.support:cardview-v7:23.1.0'compile'org.altbeacon:android-beacon-library:2.+'compile'com.cloudinary:cloudinary-android:1.2.2'compile(name:'mysdk', ext:'aar')
}
android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
and this is how I invoke activities from the cordova plugin:
@Overridepublicvoidinitialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
Logger.v(Constants.Engine.LOGGER_TAG_APP, "Plugin Initialized...");
Contextcontext= cordova.getActivity();
// This works for meIntentintent=newIntent(context, PermissionsActivity.class);
context.startActivity(intent);
}
and snipped of my plugin .xml
<!-- Initialization --><platformname="android"><config-filetarget="config.xml"parent="/*"><featurename="PlatformSDK"><paramname="android-package"value="com.mycompany.PlatformSdk.cordova.PlatformSDKCordovaPlugin" /><paramname="onload"value="true" /></feature></config-file><frameworksrc="libs/mysdk.gradle"custom="true"type="gradleReference" /><resource-filesrc="libs/mysdk.aar"target="libs/mysdk.aar" /><source-filesrc="PlatformSDKCordovaPlugin.java"target-dir="src/com/mycompany/PlatformSDK/cordova" /></platform>
Solution 2:
Okey finally I figure out the issue.
Ionic2 project need to update SDK tools by the following command
android update sdk --no-ui--filter extra
Got this input from cordova-plugin-issues
One more command was mentioned which I am not sure about which was the below one. If someone come across similar issue can try this out as well
android update sdk --no-ui--all--filter
A big Thanks to @gmmo , as he gave me the input to add all dependencies also along with plugin's
Inject.gradle
.
As I was in an impression that why would this be required after all these dependencies was already covered in Android Plugin Project.
Post a Comment for "Start Activity Residing Inside Cordova Plugin's Aar's File In Ionic2 Project"