BuildConfig not getting created correctly (Gradle Android)

前端 未结 10 701
一生所求
一生所求 2020-12-14 14:07

I am trying to convert our Android application to a gradle build. I have the project and it\'s libraries building successfully. I am now trying to create separate apks fo

相关标签:
10条回答
  • 2020-12-14 14:21

    first do

    File -> Invalidate Caches/Restart... -> Invalidate and Restart 
    

    then do

    Build -> Clean Project
    

    then do

    Build - > Rebuild Project 
    
    0 讨论(0)
  • 2020-12-14 14:22

    If you are modifying your Environment Variables, and they are not reflecting correctly in Android studio try doing:

    Build -> Clean Project 
    File -> Invalidate Caches/Restart... -> Invalidate and Restart 
    
    0 讨论(0)
  • 2020-12-14 14:24

    Try to do

    Build -> Clean Project

    then do

    Build - > Rebuild Project

    If it doesn't work, try

    File -> Invalidate Caches/Restart... -> Invalidate and Restart

    then do

    Build -> Clean Project

    then do

    Build - > Rebuild Project

    0 讨论(0)
  • 2020-12-14 14:31

    I had same issue and fixed it like below:

    buildConfigField 'String', 'BASE_URL', '"https://api.example.com"'
    
    0 讨论(0)
  • 2020-12-14 14:31

    Just in case that helps somebody else, in my case it was a missing import: import uk.co.yourpackage.yourapp.BuildConfig;

    Somehow, nowhere in the doc does it mention you need that include! Made me think it was automatically imported somehow but it ISN'T. not for me at least... So much time lost... Hope that helps another newbie like me!

    0 讨论(0)
  • 2020-12-14 14:31

    In the project.ext.envConfigFiles array, ensure you set the debug to the right .env file you are using for development

    0 讨论(0)
提交回复
热议问题