从Cocos2d项目错误的Apportable移植

时间:2013-06-03 21:38:23

标签: android porting apportable

我现在正尝试使用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问题或我的源代码是否有解决方案来修复它?

1 个答案:

答案 0 :(得分: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字符,所以如果您将来阅读这一周或两周以上,那么这个问题就没有用了。