Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassNotFound exception when calling nested static class with correct argument #1195

Closed
asimyildiz opened this issue Oct 25, 2018 · 1 comment
Assignees
Milestone

Comments

@asimyildiz
Copy link

asimyildiz commented Oct 25, 2018

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI:
  • Cross-platform modules:
  • Android Runtime: 4.2.0
  • iOS Runtime (if applicable):
  • Plugin(s):

Describe the bug

java.lang.ClassNotFoundException: com.tns.gen.com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource$Factory
When connected with chrome debugger, everything is fine, if you put a breakpoint you will see that the class is there, also from console when you try to instantiate the class with wrong argument, you will see "Invalid number of arguments" message. But when you pass the correct argument, java.lang.ClassNotFoundException exception is fired.
My gradle config (sdk versions) :
compileSdkVersion = 26 defaultConfig { minSdkVersion = 24 targetSdkVersion = 24 }

To Reproduce

add dependency to exoplayer into gradle, and try to create object from the nested static class.
dependencies {
compile 'com.google.android.exoplayer:exoplayer:2.6.1'
}
new com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource.Factory({})

Expected behavior
When passing the correct object as an argument, there shall be no java.lang.ClassNotFoundException

Sample project

Additional context

Here is the class from exoplayer library :
public class DefaultSsChunkSource implements SsChunkSource { public static final class Factory implements SsChunkSource.Factory {

also here is the interface details :
public interface SsChunkSource extends ChunkSource { interface Factory {

@asimyildiz
Copy link
Author

Here is what I did as a workaround for the problem (in case if someone faces it too) ;
I have created a new Android Library (Java)
I have added a Class and a static method which creates the instance of DefaultSsChunkSource.Factory.
Then I have built my library and put the .aar file into my NativeScript application.
I have called my Class.staticMethod to create DefaultSsChunkSource.Factory object and so now it is solved (but just by using a workaround). The main problem is still there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants