Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-24275

Hyperloop: Android - Class not found/Cannot read property 'newInstance' of null (Regression)

    Details

      Description

      Same aar is not working in hyperloop 2.0.0 while is working fine in 1.2.8.

      I have added an aar and setup everything like I did in my native app, this is how the hyperloop file looks like:

      var Configuration = require('io.ridetap.Configuration');
       
      var builder = new Configuration.Builder();
      

      Using hyperloop 1.2.8, the code above works without any problem, but starting in hyperloop 2.0.0 it crash saying Class 'io.ridetap.Configuration$Builder' not found.

      The only differences I see in the generated files for each class is that the path is different:

      In hyperloop 1.2.8 the call is this: var parentPackage = require('io.ridetap'); while in hyperloop 2.0.0 is this var parentPackage = require('./io.ridetap');

      The full log of the error is this:

      ERROR] HyperloopUtil: (main) [5188,5188] Class 'io.ridetap.Configuration$Builder' not found
      [ERROR] HyperloopUtil: java.lang.ClassNotFoundException: io.ridetap.Configuration$Builder
      [ERROR] HyperloopUtil: 	at java.lang.Class.classForName(Native Method)
      [ERROR] HyperloopUtil: 	at java.lang.Class.forName(Class.java:400)
      [ERROR] HyperloopUtil: 	at java.lang.Class.forName(Class.java:326)
      [ERROR] HyperloopUtil: 	at hyperloop.HyperloopModule.getJavaClass(HyperloopModule.java:247)
      [ERROR] HyperloopUtil: 	at hyperloop.ProxyFactory.newClass(ProxyFactory.java:81)
      [ERROR] HyperloopUtil: 	at hyperloop.HyperloopModule.getClass(HyperloopModule.java:137)
      [ERROR] HyperloopUtil: 	at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
      [ERROR] HyperloopUtil: 	at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
      [ERROR] HyperloopUtil: 	at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:872)
      [ERROR] HyperloopUtil: 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1095)
      [ERROR] HyperloopUtil: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:354)
      [ERROR] HyperloopUtil: 	at android.os.Handler.dispatchMessage(Handler.java:98)
      [ERROR] HyperloopUtil: 	at android.os.Looper.loop(Looper.java:154)
      [ERROR] HyperloopUtil: 	at android.app.ActivityThread.main(ActivityThread.java:6119)
      [ERROR] HyperloopUtil: 	at java.lang.reflect.Method.invoke(Native Method)
      [ERROR] HyperloopUtil: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
      [ERROR] HyperloopUtil: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
      [ERROR] HyperloopUtil: Caused by: java.lang.ClassNotFoundException: Didn't find class "io.ridetap.Configuration$Builder" on path: DexPathList[[zip file "/data/app/com.unosquare.p.moovel.rideTapTest-2/base.apk"],nativeLibraryDirectories=[/data/app/com.unosquare.p.moovel.rideTapTest-2/lib/x86, /system/fake-libs, /data/app/com.unosquare.p.moovel.rideTapTest-2/base.apk!/lib/x86, /system/lib, /vendor/lib]]
      [ERROR] HyperloopUtil: 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
      [ERROR] HyperloopUtil: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
      [ERROR] HyperloopUtil: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
      [ERROR] HyperloopUtil: 	... 17 more
      [ERROR] TiExceptionHandler: (main) [11,5199] ----- Titanium Javascript Runtime Error -----
      [ERROR] TiExceptionHandler: (main) [0,5199] - In /hyperloop/io.ridetap.Configuration$Builder.js:1,373
      [ERROR] TiExceptionHandler: (main) [0,5199] - Message: Uncaught TypeError: Cannot read property 'newInstance' of null
      [ERROR] TiExceptionHandler: (main) [0,5199] - Source: (function (exports, require, module, __filename, __dirname, Titanium, Ti, global, kroll) {var Hyperloop=require("hyperloop"),EnclosingClass=require("./io.ridetap.Configuration"),Builder=function(){var e;e=1==arguments.length&&arguments[0].isNativeProxy&&arguments[0].isInstanceProxy&&arguments[0].isInstanceOf("io.ridetap.Configuration$Builder")?arguments[0]:Builder.class.newInstance(arguments),this.$native=e,this._hasPointer=null!=e,this._private={}},SuperClass=require("./java.lang.Object");Builder.prototype=Object.create(SuperClass.prototype),Builder.prototype.constructor=Builder,Object.defineProperty(Builder.prototype,"super",{get:function(){return this._hasPointer?new Builder(this.$native.super):null},enumerable:!0}),Builder.className="io.ridetap.Configuration$Builder",Builder.prototype.className="io.ridetap.Configuration$Builder",Object.defineProperty(Builder,"class",{get:function(){return Hyperloop.getClass("io.ridetap.Configuration$Builder")},enumerable:!0,configurable:!1}),Builder.extend=function(e){var t=Hyperloop.extend("io.ridetap.Configuration$Builder"),n=function(){function n(e){if(e.apiName&&e.isNativeProxy&&e.isInstanceProxy){var t=require("./"+e.apiName);return new t(e)}return e}function r(){for(var e=[],t=0;t<arguments.length;t++)e[t]=n(arguments[t]);return e}var i=t.newInstance(arguments),a=this,o=e,u={};Object.keys(o).forEach(function(e){a[e]=function(){return o[e].apply(a,arguments)},u[e]=function(){return a[e].apply(a,r.apply(this,arguments))}}),i.setOverrides(u),this.$native=i,this._hasPointer=null!=i,this._private={}};return n.prototype=Object.create(Builder.prototype),n.prototype.constructor=n,n},Builder.cast=function(e){return e.$native&&e.$native.isInstanceProxy?new Builder(Hyperloop.cast("io.ridetap.Configuration$Builder",e.$native)):e},Builder.prototype.with=function(){if(!this._hasPointer)return null;var e=this.$native.callNativeFunction({func:"with",instanceMethod:!0,args:Array.prototype.slice.call(arguments)});if(null==e)return null;if(e.apiName){if("io.ridetap.Configuration$Builder"===e.apiName)return new Builder(e);var t=require("./"+e.apiName);return new t(e)}return e},Builder.prototype.setRequiresID=function(){if(!this._hasPointer)return null;var e=this.$native.callNativeFunction({func:"setRequiresID",instanceMethod:!0,args:Array.prototype.slice.call(arguments)});if(null==e)return null;if(e.apiName){if("io.ridetap.Configuration$Builder"===e.apiName)return new Builder(e);var t=require("./"+e.apiName);return new t(e)}return e},Builder.prototype.apiKey=function(){if(!this._hasPointer)return null;var e=this.$native.callNativeFunction({func:"apiKey",instanceMethod:!0,args:Array.prototype.slice.call(arguments)});if(null==e)return null;if(e.apiName){if("io.ridetap.Configuration$Builder"===e.apiName)return new Builder(e);var t=require("./"+e.apiName);return new t(e)}return e},Builder.prototype.setRequiresPayment=function(){if(!this._hasPointer)return null;var e=this.$native.callNativeFunction({func:"setRequiresPayment",instanceMethod:!0,args:Array.prototype.slice.call(arguments)});if(null==e)return null;if(e.apiName){if("io.ridetap.Configuration$Builder"===e.apiName)return new Builder(e);var t=require("./"+e.apiName);return new t(e)}return e},Builder.prototype.setLogLevel=function(){if(!this._hasPointer)return null;var e=this.$native.callNativeFunction({func:"setLogLevel",instanceMethod:!0,args:Array.prototype.slice.call(arguments)});if(null==e)return null;if(e.apiName){if("io.ridetap.Configuration$Builder"===e.apiName)return new Builder(e);var t=require("./"+e.apiName);return new t(e)}return e},Builder.prototype.build=function(){if(!this._hasPointer)return null;var e=this.$native.callNativeFunction({func:"build",instanceMethod:!0,args:Array.prototype.slice.call(arguments)});if(null==e)return null;if(e.apiName){if("io.ridetap.Configuration$Builder"===e.apiName)return new Builder(e);var t=require("./"+e.apiName);return new t(e)}return e},Builder.prototype.setMapMode=function(){if(!this._hasPointer)return null;var e=this.$na
      [ERROR] V8Exception: Exception occurred at /hyperloop/io.ridetap.Configuration$Builder.js:1: Uncaught TypeError: Cannot read property 'newInstance' of null
      [ERROR] EGL_emulation: tid 7039: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cwilliams Christopher Williams
                Reporter:
                reymundolopez Reymundo López
                Reviewer:
                Jan Vennemann
                Tester:
                Josh Longton
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-10385
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code