Duplicate Plugin Names ( Unity 2019 )

Issue #10 new
Brandon Syiem created an issue

Hi there, everytime I import this and try to build and run, I get the following error.

ound plugins with same names, Assets/StarTechPlus/uBleBridge/Source/Android/com/startechplus/unityblebridge/*.java and Assets/StarTechPlus/uBleBridge/Source/Android/*.java. Delete the one of the duplicate plugins.

When I proceed to delete the duplicate values and I try again, I get this error:

/Users/bsyiem/Documents/UnityProjects/BleTest/Temp/gradleOut/src/main/java/com/startechplus/unityblebridge/MainActivity.java:19: error: package R does not exist
getMenuInflater().inflate(R.menu.main, menu);
^
/Users/bsyiem/Documents/UnityProjects/BleTest/Temp/gradleOut/src/main/java/com/startechplus/unityblebridge/MainActivity.java:29: error: package R does not exist
if (id == R.id.action_settings) {
^

basically saying that the package R does not exists.

I looked around and found forums mentioning that this happens when the package name in the manifest doesn’t match the package name

https://stackoverflow.com/questions/22275855/package-r-does-not-exist-error-when-building-with-gradle-from-command-line

In your manifest the name of the package="com.startechplus.appse"

but the package name in the .java files is "com.startechplus.unitybridge"

I tried changing it in the manifest but that didn’t work

Note: I changed it only in the manifest in StarTechPlus/uBleBridg/Source/Android/

and not in Plugins/Android/

please advise.

Comments (4)

  1. Jason Peterson

    Hi Brandon,

    You are probably building on Unity 2019? There are some changes to how Unity handles .java files. Previous Unity versions ignored java files outside the Plugins directory. Now it looks like all java files are included by default. The source code included in the plugin is being built by the new build system. However, the pre-built “.jar” file is already included in the “Plugins->Android” folder. You need to delete or just not import the Android source folder located here “StarTestPlus->uBleBridge->Source->Android”.

    Also the manifest in the “StarTestPlus->uBleBridge->Source->Android” folder is an example and needs modified appropriately for your app and the changes made in the real manifest file located in the “Plugins->Android” folder.

    Also the Unity Player Activity has been deprecated in newer Unity versions. You need to update this in the manifest file. Change “com.unity3d.player.UnityPlayerNativeActivity” to “com.unity3d.player.UnityPlayerActivity” in the Android manifest file in “Plugins->Android->AndroidManifest.xml”

    To summarize:

    1. Delete or don’t import the “StarTestPlus->uBleBridge->Source->Android” folder
    2. Change “com.unity3d.player.UnityPlayerNativeActivity” to “com.unity3d.player.UnityPlayerActivity” in the Android manifest file in “Plugins->Android->AndroidManifest.xml”

    Let me know if this helps,

    --Jason

  2. Brandon Syiem reporter

    Hi Jason,

    Thanks for the quick response! That seems to have allowed me to build and run some examples but it doesn’t seem like I can detect the beacons that I am using (RadBeacon Dots).

    I have made sure that the beacons are transmitting. I have tried to implement a Simple scene just to scan for devices and log any information. But none of the callbacks seem to get called – indicating to me that the beacons aren’t found. I also attempted to use the AdvertisementData example to find these beacons to no avail.

    Is there something I am missing?

    thanks

    --Brandon.

  3. Jason Peterson

    Hi Brandon,

    Both Android and iOS hijack Beacon packets and don’t send them to the BLE stack they are sent to the Location Services stack. If you want to use Beacons you need to use a specific Beacon plugin or use CoreLocation Framework on iOS or the Google Beacon Platform API’s on Android.

    If your beacon also advertises normal BLE Services make sure you modified the examples to include the UUID of the service you are interested in or the name of the device you are trying to connect to. In most of my examples there is a simple name filter in the “DiscoveredPeripheralAction” callback, see the snippet:

    if(name == "Star Technologies")
    {
        this.deviceId = peripheralId;
    }
    

    However given that you said nothing shows up in your scan indicates that the RadBeacon is only sending out Beacon packets not BLE Services…

    Hope this helps,

    --Jason

  4. Log in to comment