欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

cocos 编译 apk 出错 resove to a path with no project.properties

程序员文章站 2024-03-23 12:14:52
...

打包andriod 时,出现编译错误,现象如下:

cocos 编译 apk 出错 resove to a path with no project.properties
找到D:\Cgywin\home\game_proj\client_buer\cocos2d\cocos\platform\android\java 目录,发现没有project.properties文件,替换 编译目录(D:\Cgywin\home\game_proj\client_buer\proj.android)下的project.properties文件,
内容如下

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-19
android.library.reference.1=../cocos2d/cocos/platform/android/java

顺便替换local.properties文件,内容如下:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=C:\\Program Files (x86)\\Android\\android-sdk

接着开始编译,发现还是错误, 咳咳,好多java xxx 啥的错误,晕倒,应该是有问题,
上网找了 resove to a path with no project.properties file for project ,

1、 把project.properties 文件修改下 把 android.library.reference.1=../cocos2d/cocos/platform/android/java 替换成android.library=false

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-19

#android.library.reference.1=../cocos2d/cocos/platform/android/java
android.library=false

2、 * 上说 可能是因为 android.library路径和project路径不是在同一盘符(window)!,我这个貌似是在同一目录下,pass
3、 有的网友说要把obj目录删除在试试,结果还是不行;
4、 没法了,去原先能编译的目录拷贝这两个文件试试,结果,就,就可以了,咳咳
如下,其实就是把project.properties改成android.library=true

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-19

android.library=true

local.properties改成如下(事实证明其实这个文件没有也没关系)

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=D:\\workspace\\android\\android-sdk-windows
相关标签: cocos apk