anonymous Log in
Search
Recents:
v3.0
sd
NoClassDefFoundError: No ExternalApiDefinition was found for 'MyApi'.
18/12/20 14:02

Miguel Figueroa

Replies: 5

Amigos
Estuve siguiendo el ejemplo de MyApi y todo caminó bien hasta el momento de
ejecutar, cuando me encontré con esto:
FATAL EXCEPTION: AsyncTask #2
Process: com.artech.javamessagebackground.mainmenu, PID: 17841
java.lang.RuntimeException: An error occurred while executing
doInBackground()
at android.os.AsyncTask$4.done(AsyncTask.java:399)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at
java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:929)
Caused by: java.lang.NoClassDefFoundError: No ExternalApiDefinition was
found for 'MyApi'.
at
com.artech.externalapi.ExternalApiFactory.createInstance(ExternalApiFactory.java:42)
at com.artech.actions.ApiAction.runExternalObjectMethod(ApiAction.java:69)
at com.artech.actions.ApiAction.Do(ApiAction.java:57)
at com.artech.actions.CompositeAction.Do(CompositeAction.java:119)
at
com.artech.actions.ActionExecution$2.doInBackground(ActionExecution.java:360)
at
com.artech.actions.ActionExecution$2.doInBackground(ActionExecution.java:349)
at android.os.AsyncTask$3.call(AsyncTask.java:378)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 4 more
Qué hice mal?
Agradezco comentarios.
salu2!!!
Replies

jpgonzab

18/12/20 14:05
Miguel, Parece que quedó mal declarada (o directamente no copiaste) la parte del Library que debe ir dentro del directorio Libraries. ¿Podés verificarlo? En caso de que hayas hecho modificaciones al ejemplo, te recomiendo que revises que las referencias al External Object y al ModuleClass en el archivo .library sean correctas. Saludos, On Fri, Dec 18, 2020 at 11:02 AM Miguel Figueroa J. < miguel.figueroa.j@gmail.com>

Miguel Figueroa

18/12/20 14:21
En C:\Program Files (x86)\GeneXus\GeneXus16u11hf\Libraries copié la carpeta SampleLibrary, incluyendo el archivo SampleLibrary.library con lo siguiente: com.example library 1.0 com.example.samplemodule.SampleModule SampleExtensionLibrary Sample.XCExtensionTemplate.xml Sample.CopyListTemplate.xml Me parece que está bien. salu2!!! El vie, 18 de dic. de 2020 a la(s) 11:05, Juan Pablo Gonzalez ( jpgonzalez@genexus.com)

jpgonzab

18/12/20 14:29
Asumo que el External Object "MyApi" es tuyo, por lo que como tanto este como "BasicExternalObject" están bajo el mismo .library referenciando al ModuleClass com.example.samplemodule.SampleModule , debés hacer un ExternalApiFactory.addApi(myApi) dentro de dicha clase de la misma manera que se hace para BasicExternalObject para así instanciar tu External Object. Saludos, On Fri, Dec 18, 2020 at 11:21 AM Miguel Figueroa J. < miguel.figueroa.j@gmail.com>

Miguel Figueroa

18/12/20 14:53
*Me faltaba el addApi. Lo dejé así:* ExternalApiDefinition MyApi = new ExternalApiDefinition( MyApi.NAME, MyApi.class ); ExternalApiFactory.addApi(MyApi); *Pero ahora el gradlew uploadArchives me está dando esto:* > Task :library:compileReleaseJavaWithJavac FAILED Task :library:compileReleaseJavaWithJavac in library Starting Caching disabled for task ':library:compileReleaseJavaWithJavac' because: Build cache is disabled Task ':library:compileReleaseJavaWithJavac' is not up-to-date because: Task has failed previously. The input changes require a full rebuild for incremental task ':library:compileReleaseJavaWithJavac'. Full recompilation is required because no incremental change information is available. This is usually caused by clean builds or changing compiler arguments. file or directory 'C:\GxExtensions\SDExtensionsSample\SampleModule\library\src\release\java', not found file or directory 'C:\GxExtensions\SDExtensionsSample\SampleModule\library\build\generated\aidl_source_output_dir\release\out', not found file or directory 'C:\GxExtensions\SDExtensionsSample\SampleModule\library\build\generated\renderscript_source_output_dir\release\out', not found Compiling with JDK Java compiler API. C:\GxExtensions\SDExtensionsSample\SampleModule\library\src\main\java\com\example\samplemodule\SampleModule.java:29: error: cannot find symbol MyApi.NAME, ^ symbol: variable NAME location: variable MyApi of type ExternalApiDefinition 1 error Task :library:compileReleaseJavaWithJavac in library Finished :library:compileReleaseJavaWithJavac (Thread[Execution worker for ':' Thread 2,5,main]) completed. Took 0.178 secs. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':library:compileReleaseJavaWithJavac'. > Compilation failed; see the compiler error output for details. El vie, 18 de dic. de 2020 a la(s) 11:29, Juan Pablo Gonzalez ( jpgonzalez@genexus.com)

jpgonzab

18/12/20 14:58
Parece que en el proyecto SampleModule no tenés definida la clase MyApi con los campos correspondientes, ya que no se está encontrando la variable NAME, tal como dice el error. Te recomiendo revisar la clase BasicExternalObject para fijarte como debe hacerse. Saludos, On Fri, Dec 18, 2020 at 11:54 AM Miguel Figueroa J. < miguel.figueroa.j@gmail.com>


Back to sd