标签: app-bundle

在Mac OS X应用程序包中打包C二进制文件

我正在尝试将我的二进制文件打包到一个简约的应用程序包中.但是我看到结果有些奇怪的行为.

我的包有这个最小的结构:

$ ls -R HelloWorld.app
Contents

HelloWorld.app/Contents:
Info.plist MacOS      PkgInfo

HelloWorld.app/Contents/MacOS:
helloworld
Run Code Online (Sandbox Code Playgroud)

helloworld是一个C二进制文件,编译自:

#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv) {
    while (1) {
        printf("Hello world!\n");
        sleep(2);
    }

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

Info.plist包含:

<?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>
    <key>CFBundleExecutable</key>
    <string>helloworld</string>
    <key>CFBundleIdentifier</key>
    <string>com.litl.helloworld</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>HelloWorld</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0.0</string>
    <key>CFBundleVersion</key>
    <string>20</string>
    <key>LSMinimumSystemVersion</key>
    <string>10.6</string>
    <key>LSUIElement</key>
    <true/>
    <key>LSBackgroundOnly</key>
    <true/>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)

现在为了奇怪的行为.我跑的时候

open ./HelloWorld.app
Run Code Online (Sandbox Code Playgroud)

该命令挂起约30秒.之后,我可以确认helloworld二进制文件正在运行.但是它的标准输出不会出现在Console.app中.如果我以编程方式启动此捆绑包(NSWorkspace sharedWorkspace)launchApplicationAtURL ...)调用成功,但二进制文件立即退出(我可以在控制台中看到它退出时出现错误代码2).

这是在OS X 10.9.2上.

我究竟做错了什么?

macos bundle launchd app-bundle

6
推荐指数
1
解决办法
1079
查看次数

用于OS X Gatekeeper的代码签名Java应用程序

我正在尝试将Java应用程序分发给OS X用户.我没有使用Mac商店 - 它将通过我自己的网站分发.无论我尝试什么,OS X的Gatekeeper拒绝该应用程序.

这是我的方法:

(1)像往常一样构建应用程序,获取一个JAR文件

(2)appbundler按照此处的描述使用:https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html.这会在我的JAR周围创建一个运行良好的.app,并在MyApp.app/Contents/PlugIns目录中包含JVM .

(3)使用我的开发者证书签署应用程序:

codesign -s 'Developer ID Application: MyCompany Ltd' --deep MyApp.app

...过程成功完成

(4)确认.app将遵守关守的铁拳法则:

spctl --assess --verbose=4 --type execute MyApp.app

......我得到的结果是:

MyApp.app: a sealed resource is missing or invalid
Run Code Online (Sandbox Code Playgroud)

对我来说似乎不是很啰嗦!我能做错什么?或者我怎样才能获得更多信息?

SO /谷歌搜索"密封的资源......"是指签名框架(我没有)或建议使用--force选项签名(我尝试但不起作用).

java macos code-signing app-bundle osx-gatekeeper

6
推荐指数
1
解决办法
2025
查看次数

排除 Xcode 4 中文件夹引用下的特定文件

我根据这个问题添加了一个资源目录作为应用程序包的文件夹引用。我想排除一些底层文件,因为我的应用程序中不需要它们。

根文件夹下的每个文件都禁用“删除”上下文菜单项。如果我使用“创建组”添加文件,它们将被平面添加,没有任何层次结构。

是否可以删除文件夹引用下的特定文件?还有另一种方法来添加文件并保持层次结构吗?

iphone resources hierarchy app-bundle xcode4

5
推荐指数
1
解决办法
1040
查看次数

java.lang.NoSuchMethodError: 没有静态方法 asAttributeSet(Lt/g/a/a;)Landroid/util/AttributeSet; 在类 Landroid/util/Xml 中;

完全错误

java.lang.NoSuchMethodError: 没有静态方法 asAttributeSet(Lt/g/a/a;)Landroid/util/AttributeSet; 在类 Landroid/util/Xml 中;或其超类('android.util.Xml' 的声明出现在 /system/framework/framework.jar!classes2.dex 中)

我已经在 Play 商店上传了 appbundle,每当我在我的设备中从它下载应用程序时,应用程序都会崩溃,日志如下......(日志是从所有 RedMI 设备 android os 9、MIUI 11 和 10 收集的)

java.lang.NoSuchMethodError: No static method asAttributeSet(Lt/g/a/a;)Landroid/util/AttributeSet; in class Landroid/util/Xml; or its super classes (declaration of 'android.util.Xml' appears in /system/framework/framework.jar!classes2.dex)
at i.b.k.h.g.inflate(Unknown Source:21)
at xxx.yyyyyy.zzzzzz.qqqqqq.cccc.view.HomeActivity.onCreateOptionsMenu(Unknown Source:12)
at android.app.Activity.onCreatePanelMenu(Activity.java:3456)
at android.support.v4.app.i.onCreatePanelMenu(Unknown Source:2)
at i.b.k.h.i.onCreatePanelMenu(Unknown Source:2)
at android.support.v7.app.h$k.onCreatePanelMenu(Unknown Source:8)
at i.b.k.h.i.onCreatePanelMenu(Unknown Source:2)
at android.support.v7.app.l.p(Unknown Source:25)
at android.support.v7.app.l$a.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:794)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) …
Run Code Online (Sandbox Code Playgroud)

gradle app-bundle android-app-bundle dynamic-feature-module

4
推荐指数
1
解决办法
4644
查看次数

如何从OS X,Java 7上运行的Java .app包中访问资源文件?

请注意,我在谈论Java 7,因为Java .app包的info.plist规范似乎自Java 6以来有所改变.

目前我的代码如下所示:

  File file = new File( "documentation/index.html" );
  if (file.exists()) {
      // opens the URI in the browser
      GUIUtils.openURI( file.toURI() );
  } else {
      // opens the URI in the browser
      GUIUtils.openURI( getClass().getResource( "/documentation/index.html" ).toURI() );
  }
Run Code Online (Sandbox Code Playgroud)

Java应用程序包的子文件夹中,我有一个"文档"子文件夹.我尝试过多种方法但无济于事:

  • 在info.plist中,将工作目录设置为Java文件夹(具有-Duser.dirJVMArgument属性) - 该文件看似具有正确的路径,但file.exists()返回false.
  • 尝试将ClassPath设置为Java文件夹.(getClass().getResource()仍然返回null)

java macos resource-files app-bundle java-7

3
推荐指数
1
解决办法
1208
查看次数

appbundle-maven-plugin 在使用 java 10 的 mac OSX 上失败

我尝试使用 appbundle-maven-plugin 打包我的应用程序,但出现以下错误:

[ERROR] Failed to execute goal sh.tak.appbundler:appbundle-maven-plugin:1.2.0:bundle (default) on project mailAutomatedReply: Execution default of goal sh.tak.appbundler:appbundle-maven-plugin:1.2.0:bundle failed: An API incompatibility was encountered while executing sh.tak.appbundler:appbundle-maven-plugin:1.2.0:bundle: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>sh.tak.appbundler:appbundle-maven-plugin:1.2.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/home/.m2/repository/sh/tak/appbundler/appbundle-maven-plugin/1.2.0/appbundle-maven-plugin-1.2.0.jar
[ERROR] urls[1] = file:/Users/home/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.8/plexus-velocity-1.1.8.jar
.
.
.
[ERROR] Number of foreign imports: 1
Run Code Online (Sandbox Code Playgroud)

插件定义如下:

         <plugin>
            <groupId>sh.tak.appbundler</groupId>
            <artifactId>appbundle-maven-plugin</artifactId>
            <version>1.2.0</version>
            <configuration>
                <mainClass>package.SwingMainApp</mainClass>
                <bundleName>Inscription</bundleName>
                <iconFile>logoInscriptionsApp.png</iconFile>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>bundle</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

java版本如下:

> java -version
java …
Run Code Online (Sandbox Code Playgroud)

java maven app-bundle

3
推荐指数
1
解决办法
1052
查看次数

动态功能活动未加载,卡在安装中

我正在尝试为我的项目实现应用程序包。在启动动态模块活动时,它正在下载模块并尝试安装该模块,但无法完全安装它。它被卡住了,如下图所示。 在此输入图像描述

以下链接供参考。 https://github.com/googlesamples/android-dynamic-features

import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.view.View
import android.widget.ProgressBar
import android.widget.TextView
import com.google.android.play.core.splitinstall.*
import com.google.android.play.core.splitinstall.model.SplitInstallSessionStatus
import com.lenskart.app.R

private const val modulePackageName = "com.test.feature"

private const val htoClassname = "$modulePackageName.hto.HtoActivity"

private const val atHomeClassname = "$modulePackageName.athome.AtHomeActivity"

class BundleActivity : AppCompatActivity() {

    private val listener = SplitInstallStateUpdatedListener { state ->
        val multiInstall = state.moduleNames().size > 1
        state.moduleNames().forEach { name ->
            when (state.status()) {
                SplitInstallSessionStatus.DOWNLOADING -> {
                    displayLoadingState(state, "Downloading $name")
                }
                SplitInstallSessionStatus.REQUIRES_USER_CONFIRMATION -> {
                    startIntentSender(state.resolutionIntent().intentSender, null, 0, …
Run Code Online (Sandbox Code Playgroud)

generics android app-bundle android-app-bundle

2
推荐指数
1
解决办法
2100
查看次数

架构x86_64的未定义符号:"_ CFBundleCopyResourceURL",

尝试使用Qt访问Mac .app包中的resources文件夹的文件路径.这是我的代码:

CFURLRef appUrlRef;


appUrlRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("AFE-MP-512"),NULL,NULL);
CFStringRef filePathRef = CFURLCopyPath(appUrlRef);



qDebug() << filePathRef;

// Release references
CFRelease(filePathRef);
CFRelease(appUrlRef);
Run Code Online (Sandbox Code Playgroud)

我唯一拥有的是表单上的按钮来运行代码.尝试编译时出现以下错误:

Undefined symbols for architecture x86_64:
  "_CFBundleCopyResourceURL", referenced from:
      MainWindow::on_pushButton_clicked() in mainwindow.o
  "_CFBundleGetMainBundle", referenced from:
      MainWindow::on_pushButton_clicked() in mainwindow.o
  "_CFRelease", referenced from:
      MainWindow::on_pushButton_clicked() in mainwindow.o
  "_CFURLCopyPath", referenced from:
      MainWindow::on_pushButton_clicked() in mainwindow.o
  "___CFConstantStringClassReference", referenced from:
      CFString in mainwindow.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ProgramLaunch.app/Contents/MacOS/ProgramLaunch] …
Run Code Online (Sandbox Code Playgroud)

c++ qt app-bundle cfurl-encoding

0
推荐指数
1
解决办法
1401
查看次数

如何将文件保存到appbundle中

我有一个名为的图像my-image.我可以将此图像保存到应用程序包吗?如果是,您可以向我提供代码或路径吗?

截至目前,我有以下代码 -

NSData * imageData = UIImagePNGRepresentation(userSavedImage); //convert image into .png format.
NSFileManager * fileManager = [NSFileManager defaultManager];//create instance of NSFileManager
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); //create an array and store result of our search for the documents directory in it
NSString * documentsDirectory = [paths objectAtIndex:0]; //create NSString object, that holds our exact path to the documents directory
NSString * fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png",txtImageName.text]]; //add our image to the path

[fileManager createFileAtPath:fullPath contents:imageData …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch objective-c app-bundle

-2
推荐指数
1
解决办法
748
查看次数