本文介绍了将URL添加到Gradle的BuildConfig文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的BuildConfig由Gradle生成。我的一个字符串是一个URL。当我尝试创建一个apk时,我得到了有关URL中:
的错误。任何想法我应该告诉gradle所以这工作正常吗?
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?
这是我告诉Gradle:
Here is what I told Gradle:
buildConfigField "String","My_CLOUD_API","http://12.3.456.789:123"
以下是创建的BuildConfig.java常量
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
推荐答案
试试
try
buildConfigField "String", "MY_CLOUD_API", '"http://12.3.456.789:123"'
这篇关于将URL添加到Gradle的BuildConfig文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!