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

MacOS cannot apply microphone permission #433

Closed gfek2001zz closed 1 month ago

gfek2001zz commented 1 month ago

in info.plist add image not responding

May I ask how to solve this!

fvarrui commented 1 month ago

Hi @gfek2001zz! I think you should add next entries to your app's entitlements file:

So, you can create your own entitlements file (e.g. entitlements.plist) for your app like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <!-- 
            Allow Execution of JIT-compiled Code Entitlement
            https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_allow-jit
        -->
        <key>com.apple.security.cs.allow-jit</key>
        <true/>
        <!-- 
            Allow Unsigned Executable Memory Entitlement
            https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_allow-unsigned-executable-memory
        -->
        <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
        <true/>
        <!--
            Disable Executable Memory Protection Entitlement
            https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_disable-executable-page-protection
        -->
        <key>com.apple.security.cs.disable-executable-page-protection</key>
        <true/>
        <!--
            Allow DYLD Environment Variables Entitlement
            https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_allow-dyld-environment-variables
        -->
        <key>com.apple.security.cs.allow-dyld-environment-variables</key>
        <true/>
        <!--
            Disable Library Validation Entitlement
            https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_disable-library-validation
        -->
        <key>com.apple.security.cs.disable-library-validation</key>
        <true/>
        <!--
            Allow microphone access
            https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_device-microphone
        -->
        <key>com.apple.security.device.microphone</key>
        <true/>
        <!--
            Allow camera access
            https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_device-camera
        -->
        <key>com.apple.security.device.camera</key>
        <true/>
    </dict>
</plist>

and then set macConfig.entitlements=path/to/entitlements.plist

I hope it helps!

gfek2001zz commented 1 month ago

Hi,@fvarrui Does the entitlements.plist I created conflict with the auto-generated info.plist?

fvarrui commented 1 month ago

Hi,@fvarrui Does the entitlements.plist I created conflict with the auto-generated info.plist?

Which are your entitlements?

gfek2001zz commented 1 month ago

image

What is the reason for this error?

image

Copy the entitlements.plist you uploaded

gfek2001zz commented 1 month ago

thank you @fvarrui The problem has been resolved!

in entitlements.plist add

image

fvarrui commented 1 month ago

Hi @gfek2001zz! Great, glad to hear it. Sorry I couldn't help you more, but I don't have a Mac to test