fvarrui / JavaPackager

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.
GNU General Public License v3.0
1.07k stars 133 forks source link

Could not find the main bundle or the Info.plist is missing a CFBundleIdentifier in ‘MyApp_1.0.0.pkg’. Unable to validate your application. (-21017) #221

Closed kerner1000 closed 2 years ago

kerner1000 commented 2 years ago

I'm submitting a…

Short description of the issue/suggestion:

Build succeeds but I cannot upload to AppStore. I am validating my package by the following command:

xcrun altool --validate-app -f MyApp_1.0.0.pkg --type osx --apiKey "<my-key>" --apiIssuer "<my-issuer>"
*** Error: Validation failed for 'MyApp_1.0.0.pkg'.
*** Error: Could not find the main bundle or the Info.plist is missing a CFBundleIdentifier in ‘MyApp_1.0.0.pkg’. Unable to validate your application. (-21017)

I mount the dmg file, then open "MyApp.app" -> Show Package Contents, Contents/Info.plist. In Info.plist there is a CFBundleIdentifier entry.

If I expand the pkg file using pkgutil --expand MyApp_1.0.0.pkg expanded, I see a PackageInfo file, that does contain a bundle id, but no CFBundleIdentifier...

<?xml version="1.0" encoding="utf-8"?>
<pkg-info overwrite-permissions="true" relocatable="false" identifier="com.myapp" postinstall-action="none" version="1.0.0" format-version="2" generator-version="InstallCmds-807 (21F79)" install-location="/Applications" auth="root">
    <payload numberOfFiles="133" installKBytes="66905"/>
    <bundle path="./MyApp.app" id="com.myapp" CFBundleShortVersionString="1.0.0" CFBundleVersion="1.0.0"/>
    <bundle-version>
        <bundle id="com.myapp"/>
    </bundle-version>
    <upgrade-bundle>
        <bundle id="com.myapp"/>
    </upgrade-bundle>
    <update-bundle/>
    <atomic-update-bundle/>
    <strict-identifier>
        <bundle id="com.myapp"/>
    </strict-identifier>
    <relocate>
        <bundle id="com.myapp"/>
    </relocate>
</pkg-info>
kerner1000 commented 2 years ago

I found a solution by using productbuild instead of pkgbuild. Will submit a PR soon. :)

fvarrui commented 2 years ago

I found a solution by using productbuild instead of pkgbuild. Will submit a PR soon. :)

Great!