使用Android Studio 3.1和gradle 3.1.0构建项目时出错

时间:2018-03-28 22:09:32

标签: java android android-studio gradle

我对这个项目有一个问题,我在尝试将Android Studio更新到3.1版本之后尝试构建它,我还更新了gradle到版本3.1.0,只是gradle Sync工作正常,但是尝试编译所有项目显示我这个错误。

我已经将构建工具和所有库更新到版本27.1.0,将所有编译更新为实现

Dim strReports() As String
    Dim thefiles As Array
    Dim strZipFileName As String
    Dim dateTimeNow As String = DateTime.Now
    Dim dateOnlyString As String = dateTimeNow.ToString
    Dim buffer As Byte() = New Byte(4095) {}
    Try


        strReports = Split(strReport, "/") 'strReports(0) strReports(1)

            strZipFileName = "xxx.zip"

        Dim outStream As MemoryStream = New MemoryStream()
        Using zipOutputStream As New ZipOutputStream(outStream)
            zipOutputStream.SetLevel(9)
            thefiles = Directory.GetFiles(ConfigurationManager.AppSettings.Get("ReportLookup").ToString() & strUser, strReportNameSearch & "*", SearchOption.TopDirectoryOnly)
            For Each fileName As String In thefiles
                Dim fs As Stream = File.OpenRead(fileName)
                Dim entry As New ZipEntry(Path.GetFileName(fileName))
                entry.Size = fs.Length
                zipOutputStream.PutNextEntry(entry)

                Dim count As Integer = fs.Read(Buffer, 0, Buffer.Length)
                While count > 0
                    zipOutputStream.Write(Buffer, 0, count)
                    count = fs.Read(Buffer, 0, Buffer.Length)
                    If Not Response.IsClientConnected Then
                        Exit While
                    End If
                    Response.Flush()
                End While
                fs.Close()
            Next
            zipOutputStream.Flush()
            outStream.Flush()

            Dim wholezip As String = ConfigurationManager.AppSettings.Get("ReportLookup").ToString() & strReport & "\" & strZipFileName
            If (File.Exists(wholezip)) Then
                File.Delete(wholezip)
            End If
            Using fs As FileStream = New FileStream(wholezip, FileMode.Create)
                'outStream.Seek(0, SeekOrigin.Begin)
                outStream.Position = 0

                outStream.CopyTo(fs)

            End Using
            zipOutputStream.Close()

        End Using
    Catch ex As Exception
        ExceptionManager.Publish(ex)
    End Try

还有另一个类似情况的问题HERE,但是使用kotlin完成,所以应该有一些差异。

非常欢迎您提供任何帮助。

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,这是解决问题的解决方案。

我对布局文件中定义的每个视图使用findViewById来获取XML的引用。

但在Android Studio 3.1中我不再需要使用它。

我只是删除了我放置的所有findViewById代码,以便从XML布局中获取引用,现在错误消失了!

答案 1 :(得分:0)

在这种情况下,关闭Instant Run对我有帮助。 文件-设置-构建,执行,部署-即时运行,请关闭“启用即时运行..”复选框。