2017-01-02 46 views
4

我最近將我的Eclipse項目導入Studio。我通過從Eclipse導出的gradle導出它。導入後,我得到這個錯誤。意外的char''build.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'] 
     } 
+1

嘗試用(/)正斜槓? – Raghavendra

+0

嘗試以這種方式['src/main/res',src/main/res2'] – siddhesh

+0

正向斜線解決了它。 @Raghavendra Thanks.Sorting sdk – Googler

回答

0

使用雙反斜線\\轉義反斜線

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'] 
} 
1

意外字符 '\'

馬虎錯誤

添加/,而不是\。然後Clean-RebuildRUN

aidl.srcDirs = ['libs/ormlite-android','libs/ormlite-core','src']