0

I have made an simple app from the eclipse new android application wizard. At this point, everything worked fine.

After adding pdfnet.res to the project, the program can't start without crashing. the error was

10-20 15:28:41.035: E/AndroidRuntime(16287): FATAL EXCEPTION: main
10-20 15:28:41.035: E/AndroidRuntime(16287): Process: at.aec.solutions.pdftronviewer, PID: 16287
10-20 15:28:41.035: E/AndroidRuntime(16287): java.lang.RuntimeException: Unable to start activity ComponentInfo{at.aec.solutions.pdftronviewer/at.aec.solutions.pdftronviewer.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030000
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.os.Handler.dispatchMessage(Handler.java:102)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.os.Looper.loop(Looper.java:136)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.app.ActivityThread.main(ActivityThread.java:5001)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at java.lang.reflect.Method.invokeNative(Native Method)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at java.lang.reflect.Method.invoke(Method.java:515)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at dalvik.system.NativeStart.main(Native Method)
10-20 15:28:41.035: E/AndroidRuntime(16287): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030000
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.content.res.Resources.getValue(Resources.java:1123)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.content.res.Resources.loadXmlResourceParser(Resources.java:2309)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.content.res.Resources.getLayout(Resources.java:939)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.view.LayoutInflater.inflate(LayoutInflater.java:395)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.app.Activity.setContentView(Activity.java:1929)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at at.aec.solutions.pdftronviewer.MainActivity.onCreate(MainActivity.java:13)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.app.Activity.performCreate(Activity.java:5231)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
10-20 15:28:41.035: E/AndroidRuntime(16287):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
10-20 15:28:41.035: E/AndroidRuntime(16287):    ... 11 more

But i didn't change anything on the project itself.

And here is the manifest:

                <uses-sdk
                    android:minSdkVersion="15"
                    android:targetSdkVersion="21" />

                <application
                    android:allowBackup="true"
                    android:icon="@drawable/ic_launcher"
                    android:label="@string/app_name"
                    android:theme="@style/AppTheme" >
                    <activity
                        android:name=".MainActivity"
                        android:label="@string/app_name" >
                        <intent-filter>
                            <action android:name="android.intent.action.MAIN" />

                            <category android:name="android.intent.category.LAUNCHER" />
                        </intent-filter>
                    </activity>
                </application>

            </manifest>

btw, any other raw resource works fine. Only pdfnet.res is making problems. And as told in the getting-started-guide, i can't do anything without this res file.

Is there maybe a problem with VIsual Studio 2005? I am using Eclipse for Android Development, but the extension .res is linked with VS 2005.

Thanks in advance, Lukas

Lukas
  • 196
  • 12
  • It seems that this happens only on my windows machine. Nevertheless, it' really annoying. – Lukas Oct 20 '14 at 14:26

1 Answers1

0

What are you using to compile the project? Visual Studio 2005?

Could you try using either Eclipse (https://developer.android.com/sdk/index.html?hl=i) or Android Studio to see if there is still problem with the resource file?

Make sure you are putting it in the appropriate folder (i.e. res/raw) and calling it as:

PDFNet.initialize(this, R.raw.pdfnet);
Shirley G
  • 352
  • 2
  • 9
  • Sorry for the misunderstanding, i am using eclipse for Android Development. The odd thing is, i don't come so far that i can include the pdfnet library. If i insert pdfnet.res into the res/raw directory, the app won't start anymore. – Lukas Oct 21 '14 at 07:12
  • Were you able to run the samples in Eclipse? Those samples should be able to run as is in Eclipse following the readme instruction inside the package (File->New->Other->Android Project from Existing Code). – Shirley G Oct 27 '14 at 16:40