Android
The way Unity collecting resources for building jar is obviously changed, so I changed plugin resources structure to fit new rules, but there is the issue with I do not know how to fix:
AndroidManifest.xml:6: error: Error: No resource found that matches the given name (at 'value' with value '@string/app_id').
But the is string app id value in the project:
in Assets/Plugins/Android/res/values/ids.xml:
IOS
When I try to compile the Xcode project (Xcode 6) the scripts from Assets/Plugins/IOS isn’t added to the Xcode project. I saw in the release notes that deep plugin folder support added, but nothing about that scripts from Assets/Plugins/IOS will not work any more.
Can you give my advice how should I update folders structure to make it work.
I hope Unity will notice with thread and will provide at leas some instruction of how to manage native plugins with Unity 5 or is it just issue of Unity 5b.
Bump. Having this issue in Unity 5.0.0b14. Unable to build to android because the “No resource found” error for the XML/file_paths and Integer/google_play_services_version, despite them being available.
@lacost native plugins should be just fine with the new Plugin Importer. Default processor architecture is armv7a. If you experience more issues - please submit a bug report.
As for your manifest error - we are dropping support for resources in Assets/Plugins/Android/res. You should create an Android library project and move resources there, more details here: Unity - Manual: Create and use plug-ins in Android , section Android Library Projects.
This is the recommended way of doing things, though we will probably introduce a backward-compatible solution soon.
@DMTSource you should take a look at your resources as well.
In Java code I get Uri for shared file in internal storage using FileProvider class (line 26).
@SuppressLint("NewApi")
public static Uri getImageUri(Context inContext, byte[] byteArray) {
try {
Log.d("AndroidNative", "Creating Share URI with external storage");
Bitmap bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
String path = Images.Media.insertImage(inContext.getContentResolver(), bmp, "Screenshot", null);
ShredUri = Uri.parse(path);
Log.d("AndroidNative", ShredUri.toString());
return ShredUri;
} catch (Exception ex) {
try {
Log.d("AndroidNative", "Creating Share URI with local storage");
File tempFile;
tempFile = new File(inContext.getCacheDir(), "screen.png");
FileOutputStream fos = new FileOutputStream(tempFile);
fos.write(byteArray);
fos.close();
Log.d("AndroidNative", "Time to Get Uri From FileProvider");
ShredUri = FileProvider.getUriForFile(SocialConf.GetLauncherActivity(), SocialConf.GetLauncherActivity().getPackageName() + ".fileprovider", tempFile);
return ShredUri;
} catch (Exception ex2) {
Log.i("AndroidNative", "Get Uri from FileProvider failed! " + ex2.getMessage());
return Uri.parse("");
}
}
}
But, unfortunatelly, I have next exception while getting image uri from FileProvider:
12-21 16:11:04.011: D/AndroidNative(25775): Creating Share URI with local storage
12-21 16:11:04.014: D/AndroidNative(25775): Time to Get Uri From FileProvider
12-21 16:11:04.016: I/AndroidNative(25775): Get Uri from FileProvider failed!
12-21 16:11:04.016: W/System.err(25775): java.lang.NullPointerException: println needs a message
12-21 16:11:04.017: W/System.err(25775): at android.util.Log.println_native(Native Method)
12-21 16:11:04.017: W/System.err(25775): at android.util.Log.d(Log.java:139)
12-21 16:11:04.017: W/System.err(25775): at com.androidnative.features.social.common.SocialGate.getImageUri(SocialGate.java:219)
12-21 16:11:04.017: W/System.err(25775): at com.androidnative.features.social.common.SocialGate.StartShareIntentMedia(SocialGate.java:54)
12-21 16:11:04.018: W/System.err(25775): at com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method)
12-21 16:11:04.018: W/System.err(25775): at com.unity3d.player.ReflectionHelper.a(Unknown Source)
12-21 16:11:04.018: W/System.err(25775): at com.unity3d.player.ReflectionHelper$1.invoke(Unknown Source)
12-21 16:11:04.018: W/System.err(25775): at $Proxy0.run(Native Method)
12-21 16:11:04.018: W/System.err(25775): at android.os.Handler.handleCallback(Handler.java:808)
12-21 16:11:04.018: W/System.err(25775): at android.os.Handler.dispatchMessage(Handler.java:103)
12-21 16:11:04.018: W/System.err(25775): at android.os.Looper.loop(Looper.java:193)
12-21 16:11:04.019: W/System.err(25775): at android.app.ActivityThread.main(ActivityThread.java:5292)
12-21 16:11:04.019: W/System.err(25775): at java.lang.reflect.Method.invokeNative(Native Method)
12-21 16:11:04.019: W/System.err(25775): at java.lang.reflect.Method.invoke(Method.java:515)
12-21 16:11:04.019: W/System.err(25775): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
12-21 16:11:04.019: W/System.err(25775): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
12-21 16:11:04.020: W/System.err(25775): at dalvik.system.NativeStart.main(Native Method)
In previous versions of Unity project worked correctly.
As we know Unity 5 has new logic for collecting resources needed for build.
Could you give me any advice to fix this issue?
The pictures in your post seem to be missing, or is it just for me?
Do I understand it correctly that you created a Android Library project, compiled it into .jar, and then just dropped the .jar onto Unity project?
The documentation may be a bit unclear, but you need to drop your whole library project folder into Assets/Plugins/Android/%your_library_name%
It should contain project.properties and Android.manifest in the root, res/ and bin/ folders with compiled .jar file etc.
When building, Unity looks for subfolders in Assets/Plugins/Android/ that contain project.properties with library property set to true, and does appropriate res/ folder merge, manifest merge, .jar merge etc.
Hope that helps.
P.S. We are providing a backward compatible method to provide resources in Assets/Plugins/Android/res in the upcoming beta. It will drop a warning, but should work.