问题
My BuildConfig is generated by Gradle. One of my strings is a URL. When I try to create an apk, I get an error about the :
in the url. Any ideas what I should tell gradle so this works fine?
Here is what I told Gradle:
buildConfigField "String","My_CLOUD_API","http://12.3.456.789:123"
Here is the BuildConfig.java constant that was created
public static final String My_CLOUD_API = http://12.3.456.789:123;
Here is the error:
error: ';' expected
回答1:
try
buildConfigField "String", "MY_CLOUD_API", '"http://12.3.456.789:123"'
回答2:
Try doing:
buildConfigField "String", "My_CLOUD_API", "\"http://12.3.456.789:123/\""
来源:https://stackoverflow.com/questions/41621823/adding-url-to-buildconfig-file-from-gradle