我现在正在尝试使用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问题还是我的源代码有解决的方法?
最佳答案
正如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字符,因此,如果您未来一两个星期以上阅读此书,那么这个问题就不那么重要了。