How Do I Change The Default Jcenter() Value In Android Studio?
See SO: Peer not authenticated while importing Gradle project in eclipse To eliminate errors, in new Android Studio projects I must edit build.gradle as follows: //jcenter()
Solution 1:
I made a vbscript file to do this, pasted below, and processed the following path: C:\Program Files\Android\Android Studio\plugins
No more problem with jcenter when creating a new project.
const ToRead =1
const ToWrite =2
const ToAppend =8
edit_path = ""
if wscript.arguments.count >0then edit_path =trim(wscript.arguments.item(0))
if left(edit_path,1) = """" then edit_path = mid(edit_path,2)
if right(edit_path,1) = """" then edit_path =left(edit_path,len(edit_path)-1)
if len(edit_path) =0then
msgbox "Drag and drop the folder onto this script file to process it"
wscript.quit
end if
set fso = createobject("Scripting.FileSystemObject")
dim reader,writer
if not fso.folderexists(edit_path) then
msgbox "folder not found"
wscript.quit
end if
count =0
if msgbox("The following path will be processed" & vbcrlf & _
edit_path & vbcrlf & vbcrlf & _
"Continue?",vbyesno) = vbyes then
scan edit_path
msgbox count & " files edited"
end if
sub scan(path)
set files = fso.getfolder(path).files
foreach f in files
if lcase(right(f.name,11)) = ".gradle.ftl" then edit_file path & "\" & f.name
next
set folders = fso.getfolder(path).subfolders
foreach f in folders : scan path & "\" & f.name : next
end sub
sub edit_file(file_name)
set reader = fso.opentextfile(file_name,ToRead)
a = ""
if not reader.atendofstream then a = reader.readall
reader.close
found =false
sw =true
while sw
sw =false
p = instr(1,a," jcenter()" & vblf,vbtextcompare)
if p >0then
q = instrrev(a,vblf,p)
if q >0then
sw =true
found =true
spacing = p - q +1
a =left(a,q) & space(spacing) & "//jcenter()" & vblf & _
space(spacing) & "jcenter {" & vblf & _
space(spacing) & " url ""http://jcenter.bintray.com/""" & vblf & _
space(spacing) & "}" & mid(a,p+11)
end if
end if
wend
if found then
count = count +1
fso.movefile file_name,file_name & ".save"
set writer = fso.createtextfile(file_name)
writer.write a
writer.close
end if
end sub
Post a Comment for "How Do I Change The Default Jcenter() Value In Android Studio?"