Code Monkey home page Code Monkey logo

Comments (7)

TonyJiangWJ avatar TonyJiangWJ commented on July 4, 2024

更新最新版 然后运行 config.js 进入第二项 进阶配置 开启 基于图像分析

from ant-forest.

baocq2019 avatar baocq2019 commented on July 4, 2024

10:54:04.752/E: Function importClass must be called with a class; had "[JavaPackage com.tony.BitCheck]" instead. (#14)
Function importClass must be called with a class; had "[JavaPackage com.tony.BitCheck]" instead.
at :14:0
at file:/storage/emulated/0/脚本/蚂蚁森林-Tony/core/ImgBasedFriendListScanner.js:8:0
at file:/storage/emulated/0/脚本/蚂蚁森林-Tony/core/Ant_forest.js:15:0
at _load (file:///android_asset/modules/jvm-npm.js:60:0)
at /storage/emulated/0/脚本/蚂蚁森林-Tony/main.js:19:0

main运行报错,请问大神如何解决

from ant-forest.

TonyJiangWJ avatar TonyJiangWJ commented on July 4, 2024

更新最新版1.2.0.2 然后强制结束AutoJS,这个是免费版AutoJS的bug
操作完再运行main.js 如果还有问题尝试 运行config.js 进入 进阶配置 中勾选 基于图像分析

from ant-forest.

baocq2019 avatar baocq2019 commented on July 4, 2024

10:59:05.325/E: 获取截图失败多次[3], 可能已经没有了截图权限,重新执行脚本

前期执行正常,进入好友列表下拉一次之后,log记录截图失败。重新执行脚本,到此一直重复。

from ant-forest.

baocq2019 avatar baocq2019 commented on July 4, 2024

已按步骤操作,好友列表下拉两次之后,还是获取截图失败,同样出现上述问题。

from ant-forest.

TonyJiangWJ avatar TonyJiangWJ commented on July 4, 2024
  • 尝试将lib/CommonFunction.js line:67-95 修改如下
  /**
   * 校验截图权限,权限失效则重新启动,不释放任务
   * @param {boolean} releaseLock 是否在失败后释放任务队列
   * @param {number} errorLimit 失败尝试次数
   */
  this.checkCaptureScreenPermission = function (releaseLock, errorLimit) {
    // 失败重试次数 默认值改为5
    errorLimit = errorLimit || 5
    // 获取截图 用于判断是否可收取
    let screen = null
    let errorCount = 0
    do {
      this.waitFor(function () {
        screen = captureScreen()
      }, 1000) // 延迟时间改为1000毫秒,如果依旧失败改成更大
      if (!screen) {
        _logUtils.debugInfo('获取截图失败 再试一次 count:' + (++errorCount))
      }
    } while (!screen && errorCount < errorLimit)
    if (!screen) {
      _logUtils.errorInfo(['获取截图失败多次[{}], 可能已经没有了截图权限,重新执行脚本', errorCount], true)
      this.setUpAutoStart(0.02)
      if (releaseLock) {
        _runningQueueDispatcher.removeRunningTask(true)
      } else {
        this.setSpring
      }
      exit()
    }
    return screen
  }

from ant-forest.

TonyJiangWJ avatar TonyJiangWJ commented on July 4, 2024
  • 依旧不行的话你直接改成这样好了, 这个方法本身是为了防止没有了截图权限之后,一直阻塞等待截图返回。一般是因为其他脚本运行并请求了截图权限之后导致当前脚本权限丢失。
  this.checkCaptureScreenPermission = function (releaseLock, errorLimit) {
    return captureScreen()
  }

from ant-forest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.