1

我现在正在尝试使用 Apportable 移植我的 Cocos2d 1.x 项目之一,在编译阶段出现以下错误:

     apk = env.BuildAPK(os.path.join(env['VARIANT_DIR'], env['APPLICATION_NAME'], config['APPLICATION_NAME'] + '.apk'), lib, assets + env['LIBRARY_ASSETS'])
  File "/Users/*user*/.apportable/SDK/lib/scons/engine/SCons/Environment.py", line 223, in __call__
    return self.method(*nargs, **kwargs)
  File "/Users/*user*/.apportable/SDK/site_scons/android/sdk.py", line 1123, in APKBuilder
    packaged = ResourcesFinalize(env, target=res_apk_path, source=source, assets=assets)
  File "/Users/*user*/.apportable/SDK/site_scons/android/sdk.py", line 922, in ResourcesFinalize
    all_assets = RemapAssetList(env, assets)
  File "/Users/*user*/.apportable/SDK/site_scons/android/sdk.py", line 847, in RemapAssetList
    (remap, target) = Remap(env, asset, target)
  File "/Users/*user*/.apportable/SDK/site_scons/android/sdk.py", line 723, in Remap
    (base, ext) = os.path.splitext(str(source))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0421' in position 58: ordinal not in range(128)

是SDK问题还是我的源代码有解决方案?

4

1 回答 1

1

正如 LearnCocos2D 猜测的那样,Apportable 目前不处理具有非 ASCII 名称的资源文件。

如果您想保持 IOS 项目不变,您可以将资源文件复制或链接到 ASCII 名称并相应地更新 configuration.json:

例如,在 remove_params 部分:

        "assets": [
              "Resources/Audio/@#$%\u2122!.wav",
               .....

在 add_params 部分:

        "assets": [
               "apportable/Resources/sonOfA.wav",  // link to Resources/Audio/@#$%\u2122!.wav"

此外,我们现在正在更新 Apportable 平台以正确处理非 ASCII 字符,因此,如果您在未来一两个星期以上阅读本文,那么这个问题将没有实际意义。

于 2013-06-04T00:33:14.093 回答