我最近将我的Eclipse项目导入Studio。我通过Eclipse的gradle导出导出它。导入后我收到此错误。
Error:(16, 0) Cause: startup failed:
build file 'D:\Android\Projects\MainDIr\Project\build.gradle': 16: unexpected char: '\' @ line 16, column 34.
java.srcDirs = ['libs\ormlite-android','libs\ormlite-core','src']
^
1 error
build.gradle中的4行被标记为红色。这些是引用libs文件夹库路径。我的所有库都已成功导入。
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['libs\ormlite-android','libs\ormlite-core','src']
resources.srcDirs = ['libs\ormlite-android','libs\ormlite-core','src']
aidl.srcDirs = ['libs\ormlite-android','libs\ormlite-core','src']
renderscript.srcDirs = ['libs\ormlite-android','libs\ormlite-core','src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
答案 0 :(得分:5)
意外的字符' \'
添加/
代替\
。然后清理重建和运行。
示例强>
aidl.srcDirs = ['libs/ormlite-android','libs/ormlite-core','src']
答案 1 :(得分:1)
使用双反斜杠\\
来转义反斜杠
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['libs\\ormlite-android','libs\\ormlite-core','src']
resources.srcDirs = ['libs\\ormlite-android','libs\\ormlite-core','src']
aidl.srcDirs = ['libs\\ormlite-android','libs\\ormlite-core','src']
renderscript.srcDirs = ['libs\\ormlite-android','libs\\ormlite-core','src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
答案 2 :(得分:0)