Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on PhoneGap Build Service #961

Open
DimosthenisK opened this issue Nov 30, 2018 · 32 comments
Open

Clarification on PhoneGap Build Service #961

DimosthenisK opened this issue Nov 30, 2018 · 32 comments

Comments

@DimosthenisK
Copy link

This is not a bug on the latest version, but the documentation could use a bit more clarification on the phonegap build part. How should I declare my app ID and API Key in the xml? What tag should I use? I can't find any leads from the source code.

@daksamedia
Copy link

up!

1 similar comment
@burak-kurt
Copy link

up!

@hpntk
Copy link

hpntk commented Apr 15, 2019

Seriously. The docs are way too vague here.

@mobileDev2020
Copy link

Anyone figured out how to use this plugin in Phonegap ?

@freefiona85
Copy link

@mobileDev2020 try using my fork : https://github.com/freefiona85/cordova-plugin-firebase - it works on current Firebase version and Phonegap Build. You can see quite a lot of changes and debugs there. some function was disabled temporarily, but many of the functions are still usable.

@mobileDev2020
Copy link

@freefiona85 , thanks for this update. I tried installing this plugin in my project, along with the google-services plugin as required by the firebase. I get a build error saying both these plugins are trying to install the same file google-service-Info.plist .

I commented out the google-services plugin , but the build complains the googleservice-info is already present at the destination.

If I understand the working of firebase, I am required to manually drop by project services file in the code folder. Please correct me if I am missing something.
TIA.

@freefiona85
Copy link

@mobileDev2020 we don't need to install google-services plugin anymore now as far as i tried. Also, try removing from your config.xml. it should work because it was copied via plugin (line 87, plugin.xml). I think it's more versatile if i remove that line from the plugin later, though.

@mobileDev2020
Copy link

@freefiona85 , thanks for the prompt response. I commented out services plugin from config.xml already. I have the googleservice-info file in my project that ties my project to analytics picked up by the firebase plugin. I dont understand why phonegap build says -

Failed to install 'cordova-plugin-firebase': CordovaError: Uh oh!
File already exists at destination "/private/project/***/Resources/GoogleService-Info.plist" for resource file specified by plugin cordova-plugin-firebase in iOS platform
at install (/private/project/cordova/lib/plugman/pluginHandlers.js:64:23)

@freefiona85
Copy link

oh! i see the comment section deleted what i should write!
I mean, try removing resource-file src="GoogleService-Info.plist" <--- that one from config.xml.
The error happens because both resource-file for GoogleService-Info.plist is declared inside plugin.xml and config.xml too.

I just push a new commit on my fork, removing that line on plugin.xml. Try rebuilding with the latest commit, it should remove the problem.

@mobileDev2020
Copy link

That worked.
But my app is crashing, wont even open.

@freefiona85
Copy link

freefiona85 commented Oct 11, 2019

That was weird. Any logs? can you debug it?

@Heshyo
Copy link

Heshyo commented Oct 28, 2019

@freefiona85 thanks for helping out. I tried using your plugin, without any other plugin to make sure there's no incompatibilities. It compiles on iOS (I haven't checked if it works), but it does not compile on Android.

Here the config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.company.name"
        version="1.0.0"
        xmlns="http://www.w3.org/ns/widgets"
        xmlns:gap="http://phonegap.com/ns/1.0"
        xmlns:cdv="http://cordova.apache.org/ns/1.0"
        xmlns:android="http://schemas.android.com/apk/res/android">

    <name>NAME</name>
    <content src="index.html" />
    <preference name="phonegap-version" value="cli-9.0.0" />
    <preference name="android-build-tool" value="gradle" />

    <plugin spec="https://github.com/freefiona85/cordova-plugin-firebase" />

    <platform name="android">
        <resource-file src="google-services.json" target="app/google-services.json" />
    </platform>
    <platform name="ios">
        <resource-file src="GoogleService-Info.plist" />
    </platform>
</widget>

Here's the error:

> Could not resolve all artifacts for configuration 'classpath'.
   > Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25.
     Searched in the following locations:
       - https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.pom
       - https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.jar
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.pom
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.jar
       - https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.pom
       - https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.jar
     Required by:
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > com.android.tools.build:builder:4.0.0-alpha01
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > com.android.tools.lint:lint-gradle-api:27.0.0-alpha01
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > com.android.tools.build:gradle-api:4.0.0-alpha01
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > androidx.databinding:databinding-compiler-common:4.0.0-alpha01
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > com.android.tools.build:builder:4.0.0-alpha01 > com.android.tools:sdk-common:27.0.0-alpha01
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > com.android.tools.build:builder:4.0.0-alpha01 > com.android.tools:common:27.0.0-alpha01
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > com.android.tools.build:builder:4.0.0-alpha01 > com.android.tools.build:manifest-merger:27.0.0-alpha01
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > com.android.tools.build:builder:4.0.0-alpha01 > com.android.tools.analytics-library:tracker:27.0.0-alpha01
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > com.android.tools.build:builder:4.0.0-alpha01 > com.android.tools:sdklib:27.0.0-alpha01 > com.android.tools:repository:27.0.0-alpha01
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > com.android.tools.build:builder:4.0.0-alpha01 > com.android.tools:sdk-common:27.0.0-alpha01 > com.android.tools.analytics-library:shared:27.0.0-alpha01
   > Could not find org.jetbrains.kotlin:kotlin-reflect:1.3.60-eap-25.
     Searched in the following locations:
       - https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.3.60-eap-25/kotlin-reflect-1.3.60-eap-25.pom
       - https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.3.60-eap-25/kotlin-reflect-1.3.60-eap-25.jar
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-reflect/1.3.60-eap-25/kotlin-reflect-1.3.60-eap-25.pom
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-reflect/1.3.60-eap-25/kotlin-reflect-1.3.60-eap-25.jar
       - https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-reflect/1.3.60-eap-25/kotlin-reflect-1.3.60-eap-25.pom
       - https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-reflect/1.3.60-eap-25/kotlin-reflect-1.3.60-eap-25.jar
     Required by:
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > com.android.tools.lint:lint-gradle-api:27.0.0-alpha01
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.0.0-alpha01 > com.android.tools.build:builder:4.0.0-alpha01 > com.android.tools:sdk-common:27.0.0-alpha01
   > Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25.
     Searched in the following locations:
       - https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.pom
       - https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.jar
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.pom
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.jar
       - https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.pom
       - https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.60-eap-25/kotlin-stdlib-jdk8-1.3.60-eap-25.jar
     Required by:
         unspecified:unspecified:unspecified > com.google.gms:google-services:4.3.2 > com.google.android.gms:strict-version-matcher-plugin:1.2.0

Are you using a different cli or config file?

You also said that some function was disabled temporarily. Which function(s) is that?

@freefiona85
Copy link

freefiona85 commented Oct 28, 2019

@Heshyo Oooh, there's an update to build gradle dependency few days ago. I updated the plugin so i froze the dependency to 3.5.1. Just tested myself with a clean plugin, it works with PGB.

Also, some feature that's disabled are :

  • getByteArray for remote config on android (they changed the whole process completely on Firebase)
  • get and set remote config (same as above - they changed how things works)
  • IncrementCounter (we can implement our own version)

@Heshyo
Copy link

Heshyo commented Oct 28, 2019

@freefiona85 Thanks a lot for the fast update! It now compiles on both iOS and Android, with all my necessary plugins. I haven't tried running it yet though, so I can't confirm everything is working.

Maybe you could update the readme to show it works on Phonegap Build straight, and the currently disabled features (which I don't use yet).

In case anyone uses cordova-plugin-x-socialsharing, I had the following issue when adding this plugin:

Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

but there's already a pull request to fix this. So just using that other repo fixes the build.

@freefiona85
Copy link

Readme and Travis CI updated, along with some edits. Thank you @Heshyo !

Also, yeah, x-socialsharing has a lot of problem with AndroidX build method too. Glad you found out how to fix it!

@mobileDev2020
Copy link

I am able to build successfully on iOS but app crashes , doesn't open. Any tips on how to debug ? Anyone else seeing this ?
I haven't attempted android.

Thanks!

@freefiona85
Copy link

@mobileDev2020 Have you debugged it using Browser web inspector (Safari one)? To make sure what causes it to crash on the phone.

@mobileDev2020
Copy link

@freefiona85, I have tried safari , but it doesnt go that far, I am guessing error is before app loads.
I tried to look for analytics data on the device itself. Says bug_type=211, no other useful info.
Any other place I should be looking for logs?

@freefiona85
Copy link

@mobileDev2020 Have you tried xcode device logs? Or Console.app ? http://osxdaily.com/2018/07/12/how-view-ios-logs-on-mac/
This might help. This works quite like logcat for android.

@mobileDev2020
Copy link

@freefiona85, I will try the above approach. But these logs are not easy to read through, is there anything in particular I can look for, to understand the root cause of crash.

@mobileDev2020
Copy link

@freefiona85, this console.app is a great option, thank you for that!
I see the error now -
Uncaught exception, "com.firebase.core" , could be cause by invalid GOOGLE_APP_ID in GoogleService-Info.plist .

I see that this issue was fixed long back in

#50

Wondering why it is showing up again. Anyone else seeing this ?

@mobileDev2020
Copy link

@freefona85, I got the above error when I added
"https://github.com/arnesson/cordova-plugin-firebase" .
But when I add your fork
"https://github.com/freefiona85/cordova-plugin-firebase"

I get this error at startup and app crashes
'FirebaseApp.configure' in Swift could not find a valid GoogleService-Info.plist in your project.

@mobileDev2020
Copy link

@hesyo, Can you confirm your app works with the freefiona85's fork ?

@mobileDev2020
Copy link

@freefiona85,
It appears the build as well as app crashing issues are resolved. I used your fork and the resource file - GoogleServie-Info.plist in the config.xml.

But my app has links to open up outside web pages, say , google.com, also hrefs with "tel" .
None of that functionality is working. I do have the whitelist plugin, as well as tags for access origin and allow-intent. Is there anything else from your plugin that prevents these features from opening.

@freefiona85
Copy link

Any log error on clicking the outside link, @Heshyo ? As far as i know, there are nothing that should prevent those. Did you test it on real device or simulator? Also https://stackoverflow.com/questions/33339419/phone-links-are-not-working-inside-iframe-though-it-does-work-in-div-in-ios9-web
Did you use _parent as a target? Maybe this will help.

@freefiona85
Copy link

Also it's for @mobileDev2020 , sorry.

@mobileDev2020
Copy link

@freefion85 , I am using a device to test. These links and call to tel have been working with the google analytics plugin. The only change I am making is to use the firebase plugin to support analytics due to the Oct 31st deadline for Google Analytics.
The only thing is see on logs when I click on the links are Adding Assertions. Nothing else.

@mobileDev2020
Copy link

@freefiona85 , I tried with a lower of cli too. The links are definitely getting blocked. This plugin and the whitelist plugin are not working together inspite of tags like

<allow-intent href="tel:*" />

<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" /> in config.xml. 

Is anyone else seeing these issues?

@mobileDev2020
Copy link

@freefiona85, I was able to get past these errors, html issues turns out.
But a quick question on analytics, is there a debug mode to see them right away or do I need to wait 24 hrs to see them on the firebase console ?

TIA for all your time!

@freefiona85
Copy link

@mobileDev2020 yes, you can enable debugview mode on your device. https://firebase.google.com/docs/analytics/debugview

this should help. Also, if you use logEvent, it should be able to be viewed on debugMode (along with all automatic logs like install, uninstall, open first time, and screens, for example).

@mobileDev2020
Copy link

@freefiona85, thank you !

@mobileDev2020
Copy link

Anyone got ITMS 90078 warning when you pushed your app to the AppStore ? As I said before, this plugin is the only change in my new version and we got this warning . It doesn't stop us from publishing, but since my app does not use Push Notifications, I am not clear why it asks me to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants