Coder Social home page Coder Social logo

Comments (23)

bastian-meier avatar bastian-meier commented on May 24, 2024

I can confirm this Isssue when building the Android Version on phonegap build:

:compileDebugJava/project/src/cordova/plugins/Diagnostic.java:411: error: cannot find symbol
                boolean showRationale = ActivityCompat.shouldShowRequestPermissionRationale(this.cordova.getActivity(), androidPermission);
                                                      ^
  symbol:   method shouldShowRequestPermissionRationale(Activity,String)
  location: class ActivityCompat
/project/src/cordova/plugins/Diagnostic.java:565: error: cannot find symbol
                    boolean showRationale = ActivityCompat.shouldShowRequestPermissionRationale(this.cordova.getActivity(), androidPermission);
                                                          ^
  symbol:   method shouldShowRequestPermissionRationale(Activity,String)
  location: class ActivityCompat
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
 FAILED

FAILURE: Build failed with an exception.

from cordova-diagnostic-plugin.

dpa99c avatar dpa99c commented on May 24, 2024

@srameshr are you also encountering this on phonegap build or is your build environment local?

In order to support Android 6 runtime permissions, the plugin now has a dependency on the Android support library. From the error messages, it seems this dependency is not being satisfied.

I have tested this in a local build environment, building against API 22 (Android 5.1) and API 23 (Android 6.0) and both work fine, however local build uses Gradle to satisfy the dependency on the Android support library.

According to their blog, Phonegap build now uses a Gradle build process so this shouldn't be an issue.

from cordova-diagnostic-plugin.

bastian-meier avatar bastian-meier commented on May 24, 2024

phonegap-build uses gradle, and i forced to use it per config. But it doesnt work ...

from cordova-diagnostic-plugin.

dpa99c avatar dpa99c commented on May 24, 2024

According to their twitter feed, you may need to add <preference name="android-build-tool" value="gradle" /> - have you done this?

from cordova-diagnostic-plugin.

bastian-meier avatar bastian-meier commented on May 24, 2024

yes ... and in the build log i can see that gradle is used ...

from cordova-diagnostic-plugin.

dpa99c avatar dpa99c commented on May 24, 2024

OK, I may be able to put a workaround in the plugin for phonegap build (as I said, locally it builds fine) by using reflection. I'll look into it when I get some time.

from cordova-diagnostic-plugin.

srameshr avatar srameshr commented on May 24, 2024

@dpa99c I am using cordova CLI to build.
cordova -v is 5.4.0
build fails on android 22 and 23

from cordova-diagnostic-plugin.

dpa99c avatar dpa99c commented on May 24, 2024

I'm using the same version of cordova cli and it builds fine so must be an implicit dependency that I have installed and you do not. Will look into it when I get a chance.

from cordova-diagnostic-plugin.

dpa99c avatar dpa99c commented on May 24, 2024

I've updated the plugin (v2.3.1) to add a dependency on the v7 AppCompat support library. This should pull in the required dependencies via Gradle and resolve these build issues. Note that this means the app must be built with SDK v23 or above - that means [email protected] or above - and also that Android Support Library v23+ is installed in the build environment via the SDK manager.

from cordova-diagnostic-plugin.

srameshr avatar srameshr commented on May 24, 2024

@dpa99c I will update the plugin and give it a try. Thanks.

from cordova-diagnostic-plugin.

srameshr avatar srameshr commented on May 24, 2024

After updating to SDK 23 both on AndroidManifest.xml and project.properties, I get the following error

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;

This is because of some jar file issue. It appears your lib includes annotations.jar file and I am using some other plugins that provide a android-support-v4.jar.

from cordova-diagnostic-plugin.

dpa99c avatar dpa99c commented on May 24, 2024

Until other plugins are updated to use Gradle to resolve Android library dependencies, this will be an issue. In the meantime, you can add a file platforms/android/build-extras.gradle containing the following lines:

configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
}

This should override the library dependencies injected by this plugin. Note that if the android-support-v4.jar file included by other plugin(s) isn't v23+, build errors will occur due to this plugin's dependency on android-support-v4:23+

from cordova-diagnostic-plugin.

srameshr avatar srameshr commented on May 24, 2024

Ok, Will try this out

from cordova-diagnostic-plugin.

srameshr avatar srameshr commented on May 24, 2024

@dpa99c Thanks for this!
It works.

from cordova-diagnostic-plugin.

srameshr avatar srameshr commented on May 24, 2024

@dpa99c
I have once more issue. I am not really familiar with gradle, so bear with me!

When I try to build my project via cordova cli, I get the following error

Found com.google.android.gms:play-services-location:+, but version 8.3.0 is needed for the google-services plugin.
:processDebugGoogleServices FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 8.3.0.

I guess, this is occuring because of this in my build.gradle file:

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    debugCompile project(path: "CordovaLib", configuration: "debug")
    releaseCompile project(path: "CordovaLib", configuration: "release")
    compile "com.facebook.android:facebook-android-sdk:4.+"
    compile "com.google.android.gms:play-services-location:+" // This line in particular
    // SUB-PROJECT DEPENDENCIES END
}

So to overcome this, can I add something like this in build-extras.gradle ?

dependencies {
  compile "com.google.android.gms:play-services-location:8.3.0"
}

from cordova-diagnostic-plugin.

dpa99c avatar dpa99c commented on May 24, 2024

@srameshr
This plugin doesn't add a dependency on location services, so it's likely that error is being caused by another plugin. This plugin only adds dependencies on the Android Support library as you can see in the plugin.xml:

<framework src="com.android.support:support-v4:23.+" />
<framework src="com.android.support:appcompat-v7:23.+" />

from cordova-diagnostic-plugin.

srameshr avatar srameshr commented on May 24, 2024

@dpa99c I agree. I stumbled across this after adding GCMPushPlugin. Can you let me know how to fix this?

from cordova-diagnostic-plugin.

dpa99c avatar dpa99c commented on May 24, 2024

@srameshr it has nothing to do with this plugin, so no I can't help. Raise an issue on the GCMPushPlugin repo.

from cordova-diagnostic-plugin.

srameshr avatar srameshr commented on May 24, 2024

@dpa99c Nobody responds there. If you have time please do try to look at it. Thanks for the help.

from cordova-diagnostic-plugin.

ArjunNagraj avatar ArjunNagraj commented on May 24, 2024

@dpa99c I get the following error when i am trying to make a build.

Could not find any version that matches com.android.support:support-v4:23.+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
https://repo1.maven.org/maven2/com/android/support/support-v4/
/sdk/extras/android/m2repository/com/android/support/support-v4/maven-metadata.xml

the similar error follows for the appcompat dependency.

I have installed the latest version of support via sdk manager.
Wat could be the possibilities for the error.

from cordova-diagnostic-plugin.

dpa99c avatar dpa99c commented on May 24, 2024

@ArjunNagraj Make sure you have downloaded Android Support Repository (not only Android Support Library) 

from cordova-diagnostic-plugin.

sarunkumar1990 avatar sarunkumar1990 commented on May 24, 2024

Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/
v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoV
ersionImpl;
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/acce
ssibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionI
mpl;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:50
4)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)

:transformClassesWithDexForDebug FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 25.583 secs

  • What went wrong:
    Execution failed for task ':transformClassesWithDexForDebug'.

    com.android.build.api.transform.TransformException: com.android.ide.common.pro
    cess.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.
    common.process.ProcessException: org.gradle.process.internal.ExecException: Proc
    ess 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non
    -zero exit value 2

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug
    option to get more log output.
    Error: cmd: Command failed with exit code 1 Error output:
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: C:\poorvika\platforms\android\src\cordova\plugins\Diagnostic.java uses unc
    hecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Dex: Error converting bytecode to dex:
    Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/
    v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoV
    ersionImpl;
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Landroid/support/v4/acce
    ssibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionI
    mpl;
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:50
    4)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
    at com.android.dx.command.dexer.Main.run(Main.java:277)
    at com.android.dx.command.dexer.Main.main(Main.java:245)
    at com.android.dx.command.Main.main(Main.java:106)

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':transformClassesWithDexForDebug'.

    com.android.build.api.transform.TransformException: com.android.ide.common.pro
    cess.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.
    common.process.ProcessException: org.gradle.process.internal.ExecException: Proc
    ess 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non
    -zero exit value 2

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

I am developing ionic project. please help me

from cordova-diagnostic-plugin.

ArjunNagraj avatar ArjunNagraj commented on May 24, 2024

i do not know why this occurs ....Everything works fine on my debug build.....In the release build it fails to get cordova.plugin

from cordova-diagnostic-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.