yasirkula / UnityIonicIntegration

A guide to integrating Unity 3D content into an Ionic app and sending messages between them (for Android & iOS)(tested with Vuforia plugin)
104 stars 32 forks source link

Ionic 4 Capacitor #64

Closed Dev-Root2IoT closed 4 years ago

Dev-Root2IoT commented 4 years ago

Hello,

Facing below error: MainActivity has leaked IntentReceiver org.apache.cordova.plugin.CordovaUnityLauncher$UnityToIonicBroadcastReceiver@f1117a6 that was originally registered here. Are you missing a call to unregisterReceiver()?

# ionic info

Ionic:

   Ionic CLI                     : 6.0.1 
   Ionic Framework               : @ionic/angular 4.11.8
   @angular-devkit/build-angular : 0.803.23
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.1.2

Capacitor:

   Capacitor CLI   : 1.4.0
   @capacitor/core : 1.4.0

Cordova:

   Cordova CLI       : 9.0.0
   Cordova Platforms : none
   Cordova Plugins   : no whitelisted plugins (0 plugins total)

Utility:

   cordova-res : 0.6.0
   native-run  : 0.2.8

Please help me out.

yasirkula commented 4 years ago

Does this help: https://github.com/yasirkula/UnityIonicIntegration/issues/61

Dev-Root2IoT commented 4 years ago

Yes it helped,

Still facing below error:

D/ViewRootImpl@d3e6799[MainActivity]: ViewPostIme pointer 0
D/ViewRootImpl@d3e6799[MainActivity]: ViewPostIme pointer 1
V/Capacitor/Plugin: To native (Cordova plugin): callbackId: LaunchAR1850650334, service: LaunchAR, action: launchAR, actionArgs: ["my message for Unity-side"]
D/InputMethodManager: HSIFW - flag : 0 Pid : 14346
D/Capacitor: App paused
D/ViewRootImpl@2ab5e72[MainActivity]: dispatchDetachedFromWindow
D/InputTransport: Input channel destroyed: '56732cf', fd=151
D/ViewRootImpl@d3e6799[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@8e6deb7[MainActivity]
    getNavigationBarColor() -855310
I/: Increase max job count 60
D/Capacitor: Unable to find a Capacitor plugin to handle requestCode, trying Cordova plugins 11
D/ViewRootImpl@d3e6799[MainActivity]: stopped(false) old=false
D/Capacitor/Plugin/App: Firing change: true
V/Capacitor/Plugin/App: Notifying listeners for event appStateChange
D/Capacitor/Plugin/App: No listeners found for event appStateChange
D/Capacitor: App resumed
D/ViewRootImpl@d3e6799[MainActivity]: MSG_RESIZED_REPORT: frame=[0,0][1080,2280] ci=[0,117][0,0] vi=[0,117][0,0] or=1
D/ViewRootImpl@d3e6799[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@8e6deb7[MainActivity]
    getNavigationBarColor() -855310
V/Capacitor/Plugin/Network: Notifying listeners for event networkStatusChange
D/Capacitor/Plugin/Network: No listeners found for event networkStatusChange

Also in the Unity AndroidManifest, Do we need to remove the whole activity tag ?

Right now I have commented it our

<!--    <activity android:label="@string/app_name" android:screenOrientation="fullSensor" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false" android:name="com.DefaultCompany.UnityTest.UnityPlayerActivity">-->
<!--      <intent-filter>-->
<!--        <action android:name="android.intent.action.MAIN" />-->
<!--        <category android:name="android.intent.category.LAUNCHER" />-->
<!--      </intent-filter>-->
<!--      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />-->
<!--      <meta-data android:name="android.notch_support" android:value="true" />-->
<!--    </activity>-->

SOLVED

The actual error was Unity : Failed to load 'libmain.so', the application will terminate.

At Unity Player Setting, Uncheck strip engine code and using that build in Ionic fixed this issue. Strip Engine Code