2016-01-12 35 views
1

我想喲做multiBuild與Android的工作室,但我發現了一個錯誤,當我添加的applicationID「***」productFlavors應用程序ID與Android註釋

在我的build.gradle我添加productFlavors

 productFlavors { 
    music { 

    } 

    sport { 
     applicationId "com.trueorfalse.ouam.truefalse.sport" 
     versionName "1.0-free" 
     buildConfigField "boolean", "PAID_VERSION", "false" 
    } 

} 

我得到這個錯誤:

Error:(14, 55) error: cannot find symbol class HomeFragment_ 
    Error:(15, 60) error: cannot find symbol class QuestionFragments_ 
    Error:(27, 5) error: cannot find symbol class HomeFragment_ 
    Error:(14, 55) error: cannot find symbol class HomeFragment_ 
    Error:(15, 60) error: cannot find symbol class QuestionFragments_ 
    Error:Execution failed for task ':app:compileSportDebugJavaWithJavac'. 
    > Compilation failed; see the compiler error output for details. 

是像Android這樣的註釋也不行,爲什麼?

如果我刪除的applicationID任何幫助將不勝感激

回答

0

所有工作

,我發現這裏的解決方案:Android annotations and flavors in Android Studio 1.0.1

我添加 容易{ 參數{ androidManifestFile variant.outputs [0]。 processResources.manifestFile resourcePackageName android.defaultConfig.applicationId }

我修改productFlavors這樣的:

productFlavors { 
     music { 
      applicationId android.defaultConfig.applicationId + ".music" 
     } 
     develop { 

     } 

     sport { 
      applicationId android.defaultConfig.applicationId + ".sport" 
     } 

    } 
0

我覺得你不配置以正確的方式詮釋的Android。 講究註釋中APT->參數

you should set your package name here if you are using different application IDs

defaultConfig { 
      applicationId "your.package.name" 
      ... 
} 

//Config Android annotations 
apt { 
     arguments { 
      androidManifestFile variant.outputs[0]?.processResources?.manifestFile 
      // if you have multiple outputs (when using splits), you may want to have other index than 0 

      // you should set your package name here if you are using different application IDs 
      // resourcePackageName "your.package.name" 
      resourcePackageName android.defaultConfig.applicationId 

      // You can set optional annotation processing options here, like these commented options: 
      // logLevel 'INFO' 
      // logFile '/var/log/aa.log' 
    } 
} 

    productFlavors{ 
       mj360 { 
        applicationId android.defaultConfig.applicationId + ".mj360" 
        resValue "string", "app_name", "MyDemo" 
       } 
       ... 
}