2017-07-31 28 views
0

我正在使用Android API級別18進行fleetboard應用程序。在車輛演示應用程序中,我遇到了題目中提到的錯誤。任何人都可以幫助我嗎?錯誤:嘗試從空對象上的字段'int com.fleetboard.sdk.lib.version.SdkVersion.fmajor'中讀取參考

堆棧跟蹤

java.lang.Throwable中 在com.intellij.openapi.project.DumbServiceImpl.queueTask(DumbServiceImpl.java:165) 在com.intellij.openapi.roots.impl.ProjectRootManagerComponent。 doSynchronizeRoots(ProjectRootManagerComponent.java:295) 在com.intellij.openapi.roots.impl.ProjectRootManagerImpl.fireRootsChanged(ProjectRootManagerImpl.java:414) 在com.intellij.openapi.roots.impl.ProjectRootManagerImpl.access $ 100(ProjectRootManagerImpl.java :55) at com.intellij.openapi.roots.impl.ProjectRootManagerImpl $ BatchSession.fireChange(Proje ctRootManagerImpl.java:112) 在com.intellij.openapi.roots.impl.ProjectRootManagerImpl $ BatchSession.rootsChanged(ProjectRootManagerImpl.java:125) 在com.intellij.openapi.roots.impl.ProjectRootManagerImpl.mergeRootsChangesDuring(ProjectRootManagerImpl.java: 319) at com.android.tools.idea.gradle.util.Projects.lambda $ null $ 5(Projects.java:236) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:898 ) at com.android.tools.idea.gradle.util.Projects.lambda $ executeProjectChanges $ 6(Projects.java:234) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301) at java。 awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access $ 500(EventQueue.java:97) at java.awt.EventQueue $ 3.run(EventQueue.java:709) at java.awt.EventQueue $ 3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java .security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) 在java.awt.EventQueue.dispatchEvent(EventQueue.java:726) 在com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:795) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:631) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:387) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201 ) at java.awt.EventDispatchThread.pumpEventsForFilte R(EventDispatchThread.java:116) 在java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) 在java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) 在java.awt.EventDispatchThread.pumpEvents( EventDispatchThread.java:93) 在java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

的build.gradle(APP)

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 18 
    buildToolsVersion '25.0.0' 

    defaultConfig { 
     applicationId "com.fleetboard.sdk.demo" 
     minSdkVersion 18 
     targetSdkVersion 18 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:support-v4:19.1.0' 
} 

bundle.gradle(項目)

buildscript { 
    repositories { 
     jcenter() 
     maven { url "http://jcenter.bintray.com"} 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task wrapper(type: Wrapper) { 
    gradleVersion = '2.10' //we want gradle 2.10 to run this project 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

'詮釋com.fleetboard.sdk.lib.version.SdkVersion.fmajor'

// 
// Source code recreated from a .class file by IntelliJ IDEA 
// (powered by Fernflower decompiler) 
// 

package com.fleetboard.sdk.lib.version; 

public class SdkVersion { 
    private final int fMajor; 
    private final int fMinor; 
    private final int fBugfix; 
    private final int fBuild; 
    private final String fVersionCode; 

    public SdkVersion(int major, int minor, int bugfix, int build) { 
     this.fMajor = major; 
     this.fMinor = minor; 
     this.fBugfix = bugfix; 
     this.fBuild = build; 
     this.fVersionCode = this.fMajor + "." + this.fMinor + "." + this.fBugfix + "." + this.fBuild; 
    } 

    public boolean isMajorCompatibleTo(SdkVersion other) { 
     return this.fMajor == other.fMajor; 
    } 

    public boolean isMinorCompatibleTo(SdkVersion other) { 
     return this.isMajorCompatibleTo(other) && this.fMinor <= other.fMinor; 
    } 

    public int getMajor() { 
     return this.fMajor; 
    } 

    public int getMinor() { 
     return this.fMinor; 
    } 

    public int getBugfix() { 
     return this.fBugfix; 
    } 

    public int getBuild() { 
     return this.fBuild; 
    } 

    public String getVersionCode() { 
     return this.fVersionCode; 
    } 

    public String toString() { 
     StringBuffer buffer = new StringBuffer(); 
     buffer.append("SdkVersion [fMajor="); 
     buffer.append(this.fMajor); 
     buffer.append(", fMinor="); 
     buffer.append(this.fMinor); 
     buffer.append(", fBugfix="); 
     buffer.append(this.fBugfix); 
     buffer.append(", fBuild="); 
     buffer.append(this.fBuild); 
     buffer.append(", fVersionCode="); 
     buffer.append(this.fVersionCode); 
     buffer.append("]"); 
     return buffer.toString(); 
    } 

    public int hashCode() { 
     boolean prime = true; 
     byte result = 1; 
     int result1 = 31 * result + this.fBugfix; 
     result1 = 31 * result1 + this.fBuild; 
     result1 = 31 * result1 + this.fMajor; 
     result1 = 31 * result1 + this.fMinor; 
     return result1; 
    } 

    public boolean equals(Object obj) { 
     if(this == obj) { 
      return true; 
     } else if(obj == null) { 
      return false; 
     } else if(this.getClass() != obj.getClass()) { 
      return false; 
     } else { 
      SdkVersion other = (SdkVersion)obj; 
      return this.fBugfix != other.fBugfix?false:(this.fBuild != other.fBuild?false:(this.fMajor != other.fMajor?false:this.fMinor == other.fMinor)); 
     } 
    } 
} 

在這個文件中,我發現一個通知:Decompiled.class,字節碼版本:50.0(Java 6中)...但由於未找到源,我無法安裝。

+0

發佈完整stacktrace和相關代碼 – Yazan

+0

你在哪裏嘗試運行演示應用程序?在模擬器上? –

+0

是的,我正在仿真器上運行它.. @TobiasAmon – Akash

回答

0

我們已經向公衆發佈了開發者門戶。您現在可以註冊爲開發者/應用程序提供者。

請轉到https://developer.fleetboard.com單擊「您想成爲應用程序提供商嗎?」

該向導將引導您完成註冊過程。

+0

謝謝您... @Tobias我將創建一個帳戶....我希望我能找到我的解決方案... – Akash

相關問題