EddyVerbruggen / SocialSharing-PhoneGap-Plugin

👨‍❤️‍💋‍👨 Cordova plugin to share text, a file (image/PDF/..), or a URL (or all three) via the native sharing widget
MIT License
1.78k stars 910 forks source link

Ionic v1 don't compile SocialSharing #823

Open marcelobonatto opened 7 years ago

marcelobonatto commented 7 years ago

I tried compile SocialSharing plugin in Ionic v.1, but when I test my app Ionic gives an error:

Error: cmd: Command failed with exit code 1 Error output:
D:\Testes\Ionic\ngcx\platforms\android\src\nl\xservices\plugins\SocialSharing.java:37: error: cannot find symbol
import nl.xservices.plugins.FileProvider;
                           ^
  symbol:   class FileProvider
  location: package nl.xservices.plugins
D:\Testes\Ionic\ngcx\platforms\android\src\nl\xservices\plugins\SocialSharing.java:263: error: cannot find symbol
                fileUri = FileProvider.getUriForFile(webView.getContext(), cordova.getActivity().getPackageName()+".sharing.provider", new File(fileUri.getPath()));
                          ^
  symbol: variable FileProvider
Note: D:\Testes\Ionic\ngcx\platforms\android\src\nl\xservices\plugins\SocialSharing.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

OK, I copied FileProvider.java to platforms/android/src/nl/xservices/plugins and Ionic give this error:

Error: cmd: Command failed with exit code 1 Error output:
D:\Testes\Ionic\ngcx\platforms\android\src\nl\xservices\plugins\FileProvider.java:4: error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {
                                                            ^
D:\Testes\Ionic\ngcx\platforms\android\src\nl\xservices\plugins\SocialSharing.java:263: error: cannot find symbol
                fileUri = FileProvider.getUriForFile(webView.getContext(), cordova.getActivity().getPackageName()+".sharing.provider", new File(fileUri.getPath(
)));
                                      ^
  symbol:   method getUriForFile(Context,String,File)
  location: class FileProvider
Note: D:\Testes\Ionic\ngcx\platforms\android\src\nl\xservices\plugins\SocialSharing.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

Social Sharing version: 5.1.8 Ionic version: 2.2.1 Cordova version: 6.5.0 npm version: 4.4.1 Android Tools version: 25.5.3 JDK version: 1.8.0.112

joseali93 commented 6 years ago

hey a question, can solve this ??

Dineshrajaa commented 6 years ago

Update Ionic and cordova cli and try